Skip to content

Instantly share code, notes, and snippets.

@imryan
Last active December 27, 2015 00:18
Show Gist options
  • Save imryan/7236228 to your computer and use it in GitHub Desktop.
Save imryan/7236228 to your computer and use it in GitHub Desktop.
Bottles of soda on the wall, since beer is bad.
import java.util.Scanner;
public class Bottles
{
public static void main(String[] args)
{
// Declare variables
Scanner sc = new Scanner(System.in);
int verses = 0;
// Input value for verses
System.out.println("How many verses to hear?: \n");
verses = sc.nextInt();
// Call spitRhymes() method
for (int i = verses; i >= 1; i--)
{
String verse = i + " bottles of soda on the wall, " + i + " bottles of soda.\nTake one down, pass it around, " + i + " bottles of soda on the wall.\n";
System.out.println(verse);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment