Adrita

pyramid pattern

May 7th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,i,j;
  5. scanf("%d",&n);
  6. for(i=0;i<n;i++)
  7. {
  8. for(j=0;j<2*n-1;j++)
  9. {
  10. if(j<n&&j>=n-1-i)
  11. printf("* ");
  12. else if(j>=n&&j<=n-1+i)
  13. printf("* ");
  14. else
  15. printf(" ");
  16. }
  17. printf("\n");
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment