Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3. int k ();
  4. int main(void)
  5. {
  6. //Getting Answer from user
  7. while (true)
  8. {
  9. int i = get_int ("An Integer from One to Eight:\n");
  10. //Integer Conditions
  11. if (i<1)
  12. {
  13. printf ("Try Again\n");
  14. continue;
  15. }
  16. else if (i>8)
  17. {
  18. printf ("Try Again\n");
  19. continue;
  20. }
  21. else if ((1<=i) && (i<=8))
  22. {
  23. //Start the Loopies for first Pyramid
  24. for (int j=0; j<i; j++)
  25. {
  26. for (int l=0; l<i-1-j; l++)
  27. {
  28. printf (" ");
  29. }
  30. for (int k=0; k<j+1; k++)
  31. {
  32. printf ("#");
  33. }
  34. printf (" ");
  35. //Second Pyramid Loopies
  36. for (int r=0; r<j+1; r++)
  37. {
  38. printf ("#");
  39. }
  40. printf ("\n");
  41. }
  42. break;
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement