RIYAD3403

Untitled

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