C Program to print Floyd's triangle
In this program, I have discussed about C Program to print Floyd's triangle.
The pattern is shown below---
12 3
4 5 6
7 8 9 10
#include<stdio.h>
void main()
{int i,j,c=1,n;
printf("Enter the value of n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{for(j=1;j<=i;j++)
{printf("%d ",c);
c++;}
printf("\n");
}
}
Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.
Enjoy programming in C.
0 comments:
Post a Comment