Filled Under:

C Program to print Floyd's triangle


C Program to print Floyd's triangle

https://en.wikipedia.org/wiki/C_(programming_language)


 In this program, I have discussed about C Program to print Floyd's triangle.

The pattern is shown below---
1
2 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

 

Copyright 2020 Programming in C All Right Reserved