rajamit872

Pyramid in C

Oct 8th, 2014
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. /*output of this pyramid is
  2.  
  3. ***********
  4. ***** *****
  5. ****   ****
  6. ***     ***
  7. **       **
  8. *         *
  9. **       **
  10. ***     ***
  11. ****   ****
  12. ***** *****
  13. ***********
  14. */
  15. #include<stdio.h>
  16. #include<conio.h>
  17. void main()
  18. {
  19. int i,j,k,l,c=1,d=5,z=5,m,s=2,t=7;
  20. clrscr();
  21. for(i=0;i<11;i++)
  22. printf("*");
  23. printf("\n");
  24.  
  25. for(i=0;i<5;i++)
  26. {
  27. for(j=0;j<d;j++)
  28. {
  29. printf("*");
  30. }
  31. for(k=0;k<c;k++)
  32. printf(" ");
  33. for(m=0;m<z;m++)
  34. {
  35. printf("*");
  36. }
  37. printf("\n");
  38. c+=2;
  39. d--;
  40. z--;
  41. }
  42.  
  43. for(i=0;i<4;i++)
  44. {
  45. for(j=0;j<s;j++)
  46. printf("*");
  47.  
  48. for(k=0;k<t;k++)
  49. printf(" ");
  50. for(m=0;m<s;m++)
  51. {
  52. printf("*");
  53. }
  54. s++;
  55. t=t-2;
  56. printf("\n");
  57. }
  58. for(i=0;i<11;i++)
  59. printf("*");
  60. getch();
  61. }
Advertisement
Add Comment
Please, Sign In to add comment