Practice Learning Problems for C89
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

36 lignes
977B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int rMethod(int _bottle){
  4. if(_bottle > 2){
  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 == 2){
  14. printf("%d bottles of beer on the wall!\n", _bottle);
  15. printf("%d bottles of beer!\n", _bottle);
  16. printf("Take it down, and pass it around!\n");
  17. _bottle--;
  18. printf("%d more bottle of beer on the wall!\n", _bottle);
  19. }
  20. else if (_bottle == 1){
  21. printf("%d more bottle of beer on the wall!\n", _bottle);
  22. printf("%d more bottle of beer!\n", _bottle);
  23. printf("Take it down, and pass it around!\n");
  24. _bottle--;
  25. printf("No more bottles of beer on the wall!\n");
  26. }
  27. else if (_bottle <= 0){
  28. return EXIT_SUCCESS;
  29. }
  30. return EXIT_FAILURE;
  31. }
  32. int main(void){
  33. rMethod(10);
  34. return EXIT_SUCCESS;
  35. }