I don't know how to make the "number 2" not equals to zero, because if it equals zero, it will be an exception.
I tried to let the number 2 autogenerate because if it autogenerates, the probability of being 0 is small, but it still happened.
number1=(int) (Math.random()*10); //Number 1 auto generate
number2=(int) (Math.random()*10); //Number 2 auto generate
System.out.println(number1+"/"+number2);
answer=sc.nextInt();
if(answer==(number1/number2))
{
System.out.println("You are correct, you get one point!");
points=points+1;
System.out.println("You have "+points+"points");
}
else
{
System.out.println("You are not correct, you get no point! I am sorry.");
points=points+0;
System.out.println("You have "+points+"points");
}
I expected to let it not to be 0, but it did and exception pop out.