Advertisement
Aritra15

pattern

Sep 26th, 2022
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int i,j,row;
  5.  
  6.     printf("Enter the number of rows: ");
  7.     scanf("%d",&row);
  8.  
  9.     for(i=1;i<=row;i++)
  10.     {
  11.         for(j=1;j<=row-i;j++)
  12.         {
  13.             printf(" ");
  14.         }
  15.         for(j=1;j<=i;j++)
  16.         {
  17.             printf("*");
  18.         }
  19.         for(j=1;j<i;j++)
  20.         {
  21.             printf("*");
  22.         }
  23.         printf("\n");
  24.     }
  25. }
  26.  
  27.  
  28. Enter the number of rows: 4
  29.    *
  30.   ***
  31.  *****
  32. *******
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement