Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Javanian
- */
- class bottles
- {
- public static void main(String[] args)
- {
- int n = bottles(99);
- }
- static int bottles (int n)
- {
- if(n==0)
- {
- System.out.println("No more bottles of beer on the wall, no more bottles on the wall \n Go to the store and buy some more, 99 bottles of beer on the wall");
- return 0;
- }
- if(n==1)
- {
- System.out.println(n + " bottle of beer on the wall, " + n + " bottle of beer\n Take one down and pass it around, no more bottles of beer on the wall");
- return(bottles(n-1) );
- }
- else
- {
- System.out.println(n + " bottles of beer on the wall, " + n + " bottles of beer\n Take one down and pass it around, " +( n-1) + " bottles of beer on the wall");
- return(bottles(n-1) );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement