Guest User

Untitled

a guest
Mar 3rd, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4.  
  5. int main(void)
  6.  
  7. // Get number from user between 1 and 8
  8. {
  9. int h;
  10. do
  11. {
  12. h = get_int("height: ");
  13. }
  14. while (h <= 0 || h >= 9);
  15.  
  16. // Begin the nest loop
  17. {
  18. for(int i = 0; i == h; i++);
  19. {
  20. for(int j = 0; j = i; j++);
  21. {
  22. printf("#");
  23. }
  24. printf("\n");
  25. }
  26. }
  27. }
  28.  
  29. ERROR
  30. mario.c:18:30: error: use of undeclared identifier 'i'
  31. for(int j = 0; j = i; j++);
  32. ^
  33. mario.c:16:36: error: for loop has empty body [-Werror,-Wempty-body]
  34. for(int i = 0; i == h; i++);
  35. ^
Advertisement
Add Comment
Please, Sign In to add comment