Number Magics using For loop #c

The program to get output like this
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

Popular posts from this blog

Algorithm to display "n" natural numbers #c

Algorithm to display the sum of n natural numbers #c

Algorithm for Sum of two numbers