mmayoub

Ex06, 01.05.2021

May 4th, 2021
512
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 01.05.2021
  2. import java.util.Scanner;
  3.  
  4. public class Ex06 {
  5.  
  6.     public static void main(String[] args) {
  7.         // TODO Auto-generated method stub
  8.         Scanner in = new Scanner(System.in);
  9.         int month;
  10.         int days;
  11.  
  12.         System.out.print("Enter the month number: ");
  13.         month = in.nextInt();
  14.  
  15.         switch (month) {
  16.         case 1:
  17.         case 3:
  18.         case 5:
  19.         case 7:
  20.         case 8:
  21.         case 10:
  22.         case 12:
  23.             days = 31;
  24.             break;
  25.  
  26.         case 2:
  27.             days = 28;
  28.             break;
  29.  
  30.         case 4:
  31.         case 6:
  32.         case 9:
  33.         default:
  34.             days = 30;
  35.             break;
  36.  
  37.         }
  38.  
  39.         System.out.println("Number of days = " + days);
  40.         in.close();
  41.  
  42.     }
  43.  
  44. }
  45.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×