If n is even and in the inclusive range of 2 to 5 , print Not Weird
if((n%2==0) && (n>=2&&n=>5)){
System.out.println("Not Wierd");}
This is how i wrote it, idk what mistake i did, can someone help me please?!
The whole program
import java.util.Scanner;
public class TestRank {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
scan.close();
String ans="";
// if 'n' is NOT evenly divisible by 2 (i.e.: n is odd)
if(n%2==1){
ans = "Wierd";
}
else if((n%2==0) && (n>=2&&n=>5)){
ans = "Not Wierd";
}
System.out.print(ans);
}
}
Aucun commentaire:
Enregistrer un commentaire