Skip to content

Instantly share code, notes, and snippets.

@alexejVasko
Created February 17, 2016 13:45
Show Gist options
  • Save alexejVasko/dcbc9424712436bf71dd to your computer and use it in GitHub Desktop.
Save alexejVasko/dcbc9424712436bf71dd to your computer and use it in GitHub Desktop.
package logic;
public class IfMonth {
public static void main(String[] args) {
System.out.println(isSpring(4));
System.out.println(isSpring(9));
System.out.println(isSpring(12));
System.out.println(isSpring(-1));
}
static int isSpring(int month){
if (month >= 3 && month <= 5){
return month = 1;
}
else if (month >= 1 && month < 3 || month > 5 && month <= 12){
return month = 0;
}
return -1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment