Skip to content

Instantly share code, notes, and snippets.

@edinak1
Created October 23, 2015 18:35
Show Gist options
  • Select an option

  • Save edinak1/73659e5a75950408c887 to your computer and use it in GitHub Desktop.

Select an option

Save edinak1/73659e5a75950408c887 to your computer and use it in GitHub Desktop.
package metod;
public class Spring {
public static void main(String[] args) {
int month=3;
System.out.println("Month = "+ month);
if(isSpring(month)==1)
System.out.println("It is spring!");
else if(isSpring(month)==0)
System.out.println("It is not spring(");
else
System.out.println("It is not a month!!!!!!");
month=10;
System.out.println("Month = "+ month);
if(isSpring(month)==1)
System.out.println("It is spring!");
else if(isSpring(month)==0)
System.out.println("It is not spring(");
else
System.out.println("It is not a month!!!!!!");
month=-100;
System.out.println("Month = "+ month);
if(isSpring(month)==1)
System.out.println("It is spring!");
else if(isSpring(month)==0)
System.out.println("It is not spring(");
else
System.out.println("It is not a month!!!!!!");
}
static int isSpring(int month)
{
if(month<=0 || month>12)
return -1;
if(month==3 || month==4 || month==5)
return 1;
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment