C89/99Bottles/C99Bottles.c

36 lines
977 B
C
Raw Normal View History

2019-03-09 17:44:45 -05:00
#include <stdio.h>
#include <stdlib.h>
int rMethod(int _bottle){
2019-03-10 19:07:34 -04:00
if(_bottle > 2){
2019-03-09 17:44:45 -05:00
printf("%d bottles of beer on the wall!\n", _bottle);
printf("%d bottles of beer!\n", _bottle);
printf("You take one down, and pass it around!\n");
_bottle--;
printf("%d bottles of beer on the wall!\n", _bottle);
printf("\n");
rMethod(_bottle);
}
2019-03-10 19:07:34 -04:00
else if (_bottle == 2){
printf("%d bottles of beer on the wall!\n", _bottle);
printf("%d bottles of beer!\n", _bottle);
printf("Take it down, and pass it around!\n");
_bottle--;
printf("%d more bottle of beer on the wall!\n", _bottle);
}
2019-03-09 17:44:45 -05:00
else if (_bottle == 1){
printf("%d more bottle of beer on the wall!\n", _bottle);
printf("%d more bottle of beer!\n", _bottle);
printf("Take it down, and pass it around!\n");
_bottle--;
printf("No more bottles of beer on the wall!\n");
}
else if (_bottle <= 0){
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}
int main(void){
rMethod(10);
return EXIT_SUCCESS;
}