Advertisement
EBobkunov

pyramide_from_numbers

Mar 10th, 2023
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | Source Code | 0 0
  1. #include <stdio.h>
  2. void main()
  3. {
  4.    int i,j,spacebar,rows,k,t=1;
  5.    printf("Input number of rows : ");
  6.    scanf("%d",&rows);
  7.    spacebar=rows+4-1;
  8.    for(i=1;i<=rows;i++)
  9.    {
  10.          for(k=spacebar;k>=1;k--)
  11.             {
  12.               printf(" ");
  13.             }
  14.        for(j=1;j<=i;j++)
  15.        printf("%d ",t++);
  16.     printf("\n");
  17.        spacebar--;
  18.    }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement