RIYAD3403

Untitled

Aug 18th, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a=5,b,i,j,k;
  5. printf("If u want to watch 3 row stars with _ symbol then press 1 or\nIf u want to watch diamond star press 2\n");
  6. scanf("%d",&b);
  7. if(b==1)
  8. {
  9. for(i=1;i<=a-2;i++)
  10. {
  11. for(j=a-3;j>=i;j--)
  12. {
  13. printf("_");
  14. }
  15. for(k=1; k<=2*i-1;k++)
  16. {
  17. printf("*");
  18. }
  19. printf("\n");
  20. }
  21.  
  22. }
  23. else
  24. {
  25. for(i=1;i<=a-2;i++)
  26. {
  27. for(j=a-3;j>=i;j--)
  28. {
  29. printf(" ");
  30. }
  31. for(k=1; k<=2*i-1;k++)
  32. {
  33. printf("*");
  34. }
  35. printf("\n");
  36. }
  37. for(i=a-2;i>=1;i--)
  38. {
  39. for(j=a-3;j>=i;j--)
  40. {
  41. printf(" ");
  42. }
  43. for(k=1; k<=2*i-1;k++)
  44. {
  45. printf("*");
  46. }
  47. printf("\n");
  48. }
  49. }
  50. return 0;
  51. }
Add Comment
Please, Sign In to add comment