This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Tuesday 2 July 2013

Program to print the Floyd's Triangle

#include<stdio.h>
int main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the number of rows of Floyd's triangle: ");
scanf("%d",&n);
printf("FLOYD'S TRIANGLE\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++,k++)
printf(" %d",k);
printf("\n");
}
getch();
}


No comments:

Post a Comment