Find Season of Month in Java
Here you will get the example code to find season of month in java programming.
This program is used to determine which season of a particular month. Here we are using the logical operator with Nested if else statement.
Find season of month in java program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | class season { public static void main(String str[]) { int a; String s; a=Integer.parseInt(str[0]); if(a==12||a==1||a==2) s="Winter"; else if(a==3||a==4||a==5) s="Spring"; else if(a==6||a==7||a==8) s="Summer"; else if(a==9||a==10||a==11) s="Autom"; else s="Bogus Month"; System.out.println("Enter month number is the :"+s); } } |
Output
Check out our other Java Programming Examples