Computer Science, asked by pinkgirl29, 4 days ago

Write a java program to read a month number and print corresponding ​

Answers

Answered by pathakarushi594
1

Answer:

Java program to input month number and print number of days in that month and month. */ import java.util.Scanner; class Monthdaysdisplay { public static void main(String[] args) { int month; Scanner p=new Scanner(System.in); System.out.print("Enter month number (1-12): "); month=p.nextInt(); if(month == 1) { System.out.println("JANUARY 31 days"); } else if(month == 2) { System.out.println("FEBRUARY 28 or 29 days"); } else if(month == 3) { System.out.println("MARCH 31 days"); } else if(month == 4) { System.out.println("APRIL 30 days"); } else if(month == 5) { System.out.println("MAY 31 days"); } else if(month == 6) { System.out.println("JUNE 30 days"); } else if(month == 7) { System.out.println("JULY 31 days"); }

Similar questions