Skip to content

Instantly share code, notes, and snippets.

@abdulateef
Created October 28, 2016 14:40
Show Gist options
  • Save abdulateef/1cb63797068b71616797c1b9cd90c3f1 to your computer and use it in GitHub Desktop.
Save abdulateef/1cb63797068b71616797c1b9cd90c3f1 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
import jdk.nashorn.internal.parser.TokenType;
public class ConditionStatement {
public static void main(String [] args){
/// scanner to read input name and number
///though name not neccessary
///happy coding.....
Scanner input = new Scanner(System.in);
System.out.println("Enter your Name");
String name = input.next();
System.out.println("This Code was developed by:" + " " + name +";");
System.out.println("Enter a Number");
try
{ //to read input from user
int number = input.nextInt();
//odd condition
if (number%2==1) {
System.out.println("Weird");
//even and in the range of "" condition
}else if (number%2==0 && number <=10) {
System.out.println("Not Weird");
//even and graeter than the range of "" condition
}else if (number%2==0 && number>10) {
System.out.println("Weird");
}
}catch(Exception ex)
{
//exception handler in case of wrong input
System.out.println("Enter a valid Number");
}
}
}
@jimohabdol
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment