Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void bottles(int n)
- {
- printf("%d bottles of beer on the wall, %d bottles of beer, ", n, n);
- printf("ya’ take one down, ya’ pass it around, ");
- printf("%d bottles of beer on the wall.\n", n-1);
- //bottle(n-1);
- }
- void bottle(int n)
- {
- if (n > 1)
- {
- bottles(n);
- bottle(n-1);
- }
- else if (n == 1)
- {
- bottles(n);
- bottle(n-1);
- }
- else
- {
- printf("No bottles of beer on the wall, no bottles of beer, ");
- printf("ya’ can’t take one down, ya’ can’t pass it around, ");
- printf("cause there are no more bottles of beer on the wall!\n");
- }
- }
- int main(void)
- {
- bottle(99);
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment