Also, can I suggest putting a few extra println statements in while you are trying to debug your program. Try something like
num = scan.nextInt();
System.out.println("### num = "+num+(" ###");
This will confirm whether you are reading the correct value. Put this sort of statement after every input and don't forget to display your output so you can see the result. This will help to decifer what is happening in your program. Just don't forget to comment them all out before handing in your final assignment!
Cheers,
darkagn