C programming examples with output
Floyd's Triangle
Program:
#include<stdio.h>
#iniclude<conio.h>
main()
{
int a,b,c,rows;
clrscr();
printf("Enter number of rows: ");
scanf("%d",&rows);
c=1;
for(a=0;a<rows;a++)
{
for(b=0;b<=a;b++)
{
if(c<10)
printf("%d "c);
else
printf("%d ",c);
c++;
}
printf("\n");
}
getch();
}
Output
Enter numbers of rows:5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Check others programming by click here:
Factorial of a number:
Find sum of digits of a number:
Find vowel or not:
Palindrome Number:
Floyd's Triangle
Program:
#include<stdio.h>
#iniclude<conio.h>
main()
{
int a,b,c,rows;
clrscr();
printf("Enter number of rows: ");
scanf("%d",&rows);
c=1;
for(a=0;a<rows;a++)
{
for(b=0;b<=a;b++)
{
if(c<10)
printf("%d "c);
else
printf("%d ",c);
c++;
}
printf("\n");
}
getch();
}
Output
Enter numbers of rows:5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
Check others programming by click here:
Factorial of a number:
Find sum of digits of a number:
Find vowel or not:
Palindrome Number:
0 komentar:
Post a Comment