Computer Science, asked by devanshichandak4, 8 months ago

write a program to enter the month number and print the number of days of the month using switch case​

Answers

Answered by abhay25102004
4

Answer:

Here is the answer in java language

Explanation:

import java.util.*;

public class month_name

{

public static void main(String args[])

{

int choice;

Scanner obj = new Scanner (System.in);

System.out.println("Enter the month number");

choice = obj.nextInt();

switch(choice)

case 1 :

System.out.println("January");

break;

case 1 :

System.out.println("January");

break;

case 1 :

System.out.println("January- 31 days ");

break;

case 2 :

System.out.println("February - 28 or 29 days");

break;

case 3 :

System.out.println("March- 31 days");

break;

case 4:

System.out.println("April - 30 days");

break;

case 5 :

System.out.println("May - 31 days");

break;

case 6 :

System.out.println("June - 30 days");

break;

case 7 :

System.out.println("July - 31 days");

break;

case 8 :

System.out.println("August - 31 days");

break;

case 9 :

System.out.println("September - 30 days");

break;

case 10 :

System.out.println("October - 31 days");

break;

case 11 :

System.out.println("November - 30 days");

break;

case 12 :

System.out.println("December - 31 days");

break;

default:

System.out.println("Wront month number");

}

}

Plz mark the aanswer as brainliest if u find it useful

Answered by Brenquoler
102

import java.util.*;

class Hello

{

public static void main (string args [])

{

Scanner sc=new Scanner(System .in);

int d;

System.out.println("Enter a day no.");

d=sc.nextInt();

switch=(d)

{

Case1: System.out.println("Monday");

break;

Case2: System.out.println("Tuesday");

break;

Case3: System.out.println("Wednesday");

break;

Case4: System.out.println("Thursday");

break;

Case5: System.out.println("Friday");

break;

Case6: System.out.println("Saturday");

break;

Case7: System.out.println("Sunday");

break;

default: System.out.println("Wrong Day");

}

}

}

Attachments:
Similar questions