skip to main |
skip to sidebar
FLOYD'S TRIANGLE
# include <stdio.h>
# include <conio.h>
void main ()
{
int i , j , k=1 , rows ;
clrscr () ;
printf ("How many rows : ");
scanf ("%d",&rows);
printf ("\n\n\n");
for (i = 0 ; i < rows ; i++) {
for (j = 0 ; j<=i ; j++) {
printf ("%5d",k);
k++; }
printf ("\n") ; }
getch ();
}
OUTPUT:
0 comments:
Post a Comment