Write a program to construct a pyramid of numbers .

Solution :-



#include<stdio.h>
#include<string.h>
int main()
{
 int n,i,j,k;
 while(scanf(“%d”,&n)==1)
 {

     for(i=1;i<=n;i++){
         for(j=1;j<=n-i;j++)
         printf(” “);
         for(k=1;k<=i;k++)
         printf(“1”);
         printf(“n”);
     }
}
return 0;
}


/*  
Input :-
 5
 Output :-

        1
      1 1
    1 1 1
  1 1 1 1
1 1 1 1 1

*/









At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming .

Posted by Shipu Ahamed

Leave a Reply