Hello all,
i have written a program that check if the number is even or odd:
import java.util.Scanner;
public class q3 {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int num,k=0;
System.out.println("Enter Number");
while (k==0){
num=scn.nextInt();
if (num%2!=0)
System.out.println("your number is odd, enter another number");
else k++;
}
System.out.println("your number is even");
}
}
my test case are:
num=1; the number is odd.
num=2; the number is even.
the program run fine with Eclipse.
but when i try to test it in the coderunner question as a java program, i get this error:
waiting for your reply,
thank you very much.