Menu
With the help of my tutor I wrote this segment of code. I cannot understand why I am getting a zero for num3 every time. I would like if someone could explain how to fix this.
[code]int num1=0, num2=0, num3=0;
num1 = (int) (Math.random() * 10) +1;
num2 = num1; /
while(num2 == num1) {
num2 = (int) (Math.random() * 10) +1;
while(num3 == num1 || num3 == num2)
num3 = (int) (Math.random() * 10) +1;
}
System.out.print(“n”);
System.out.print(“And the winning numbers are ” + num1 + “, ” + num2 + “, and ” + num3);