Here we written code for print Floyd triangle with output.
For improvement of your coding skills we give some tasks along with it. If you solve this tasks and send to our email (onlineexamshubteam@gmail.com) with your details. we will display your details(like Name, City, college, photo) in our site.
Task : Write a c program to print nth line of Floyd triangle.
Write a C Program to print Floyd Triangle.
#include<stdio.h>
int main()
{
int i,j,sum=1,n;
printf(“Enter no.of line want :\n”);
scanf(“%d”,&n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
printf(“%d “,sum++);
printf(“\n”);
}
}
Output :
Enter no.of line want :4 1 2 3 4 5 6 7 8 9 10
Back to the programs.
Task Achivers