Practice Learning Problems for C89
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
726B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int rMethod(int _bottle){
  4. if(_bottle > 1){
  5. printf("%d bottles of beer on the wall!\n", _bottle);
  6. printf("%d bottles of beer!\n", _bottle);
  7. printf("You take one down, and pass it around!\n");
  8. _bottle--;
  9. printf("%d bottles of beer on the wall!\n", _bottle);
  10. printf("\n");
  11. rMethod(_bottle);
  12. }
  13. else if (_bottle == 1){
  14. printf("%d more bottle of beer on the wall!\n", _bottle);
  15. printf("%d more bottle of beer!\n", _bottle);
  16. printf("Take it down, and pass it around!\n");
  17. _bottle--;
  18. printf("No more bottles of beer on the wall!\n");
  19. }
  20. else if (_bottle <= 0){
  21. return EXIT_SUCCESS;
  22. }
  23. return EXIT_FAILURE;
  24. }
  25. int main(void){
  26. rMethod(10);
  27. return EXIT_SUCCESS;
  28. }