This is a C program for generating a Floyd's Triangle
This is a part of Mumbai University MCA College C program MCA Sem 1
#include<conio.h>
void main()
{
int i , j , r ;
int num=0 ;
clrscr();
printf(“How many rows you want in the triangle:”);
scanf(“%d”,&r);
for(i=1;i<=r;i++)
{
for(j=1;j<=i;j++)
{
printf(“%d”,++num);
}
printf(“\n”);
Floyd’s triangle
#include<stdio.h>#include<conio.h>
void main()
{
int i , j , r ;
int num=0 ;
clrscr();
printf(“How many rows you want in the triangle:”);
scanf(“%d”,&r);
for(i=1;i<=r;i++)
{
for(j=1;j<=i;j++)
{
printf(“%d”,++num);
}
printf(“\n”);
}
getch();
}
2 3
4 5 6
7 8 9 10
getch();
}
Input:
How many rows you want in the triangle: 4Output:
12 3
4 5 6
7 8 9 10
Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.
Download
No comments:
Post a Comment