07 | Java Program To Print Number Of Days In a Given Month | Java Ladder If Else

preview_player
Показать описание
Preparing for the java interview or exam? Checkout my color-coded Java Revision Book that is specially designed for refreshing java concepts

Don't be a stranger '-'

Connect with me on the below platforms.

Рекомендации по теме
Комментарии
Автор

Thankyou Chirag Khimani garu...
//Print Number Of Days In a Given Month
import java.util.Scanner;

public class program3 {
public static void main(String[] args) {
Scanner m=new Scanner(System.in);
System.out.print("Enter the month: ");
int m1=m.nextInt();
if(m1==1){
System.out.println("January month have 31 Days");
} else if (m1==2) {
System.out.println("Feb month have 28 Days");
} else if (m1==3) {
System.out.println("March month have 31 Days");
}else if (m1==4) {
System.out.println("April month have 30 Days");
}else if (m1==5) {
System.out.println("May month have 31 Days");
}else if (m1==6) {
System.out.println("June month have 30 Days");
}else if (m1==7) {
System.out.println("July month have 31 Days");
}else if (m1==8) {
System.out.println("August month have 31 Days");
}else if (m1==9) {
System.out.println("September month have 30 Days");
}else if (m1==10) {
System.out.println("October month have 31 Days");
}else if (m1==11) {
System.out.println("November month have 30 Days");
}else if (m1==12) {
System.out.println("December month have 31 Days");
}else
System.out.println("Sorry!!! we have only 12 months per year");
}
}

routeofjesus
Автор

if you write this logic in interview then interviewer simply say's you can leave for the day and better luck next time

rajeshgottimukkaula
Автор

Bhai sahab ne is par video bana diya. Hats off to your confidence.

RaajKanchan
Автор

how about the user should input month name than numbers?

dennisjhoncubar