Number Magics using For loop #c
The program to get output like this
1
2 2
3 3 3
4 4 4 4
1
2 2
3 3 3
4 4 4 4
//It's a simple program.Here we print only 9 rows.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n=9,k;
//Now we use this for loop to check the number of rows.
for(i=1;i<=n,i++)
//Here we use this for loop to print like 1 or 2 2 or 3 3 3.
{ for (k=1;k<=i;k++)
printf("%d",i);
}
getch();
}
Comments
Post a Comment