please solve this:
write a program in java to accept any number from 1 to 3 and print as;
1-coffee
2-coca cola
3-tea
i will surely mark the brainliest the next minute you answer the best
Answers
Answered by
2
Explanation:
import java.util.Scanner;
class Ladder {
public static void main(String[] args) {
int number;
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer: ");
int number = input.nextInt();
if (number == 1) {
System.out.println("coffee");
}
else if (number == 2) {
System.out.println("coca cola");
}
else if (number == 3) {
System.out.println("tea");
}
}
}
Hope my answer is helpful.
Hope my answer is helpful. Mark me as the brainliest....Thank you..
Similar questions