Respuesta :
Answer:
// here is code in java.
import java.util.*;
class Main
{
// main method of the class
public static void main (String[] args) throws java.lang.Exception
{
  try{
    // variable to store the number of bottles
    int num_bot;
    Scanner scr=new Scanner(System.in);
    System.out.print("Enter number of bottles of beer on the wall:");
    //read the number of bottles
    num_bot=scr.nextInt();
    // print the output
    for(int i=num_bot;i>0;i--)
    {
     // print the first statement
     System.out.println(i+" beer bottles on the wall");
     // print the second statement
     System.out.println(i+" beer bottles . Take 1 down and pass the bottle around.");
     }
     // when there is 0 bottle
      System.out.println("0 bottles of beer on the wall.");
  }catch(Exception ex){
    return;}
}
}
Explanation:
Declare a variable "num_bot" to store the initial number of beer bottles.Then ask user to give number of bottles.Run a for loop to pass a beer bottle until there is 0 bottle on the wall. When number of bottle is 0 then it will print there is "0 bottle on the wall".
Output:
Enter number of bottles of beer on the wall:3
3 beer bottles on the wall
3 beer bottles . Take 1 down and pass the bottle around.
2 beer bottles on the wall
2 beer bottles . Take 1 down and pass the bottle around.
1 beer bottles on the wall
1 beer bottles . Take 1 down and pass the bottle around.
0 bottles of beer on the wall.