cprogram to print pyramid pattern containing numbers

C program to print following pattern. 


For n=4,


1

1 1

1 1 1

1 1 1 1


  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int i, j, n;
  5.   printf("Enter your number:");
  6.   scanf("%d", &n);
  7.   for (i=0; i<n; i++)
  8.      {
  9.  for(j=0; j<=i; j++)
  10.  printf("1 ");
  11.  printf("\n");  
  12.      }
  13.      return 0; 
  14. }

Output

Enter your number:4
1
1 1
1 1 1
1 1 1 1

choose next program from this list

Comments