Question: The program gets an input value into variable numMonths. Write code that outputs Months: , followed by the value of variable numMonths. End with a
The program gets an input value into variable numMonths. Write code that outputs "Months: ", followed by the value of variable numMonths. End with a newline. Ex: If the input is 3, then the output is: Months: 3 Ex: If the input is 6, then the output is: Months: 6 (java)
import java.util.Scanner;
public class OutputTest { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numMonths; numMonths = scnr.nextInt(); System.out.println("Months: 3");
} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
