当 if 语句在循环中时,如何退出 if 语句并继续循环?我试过 break 但没有奏效。继续刚刚制作的程序不断要求我输入一个数字。import java.io.*;public class pg48{ public static void main()throws IOException { InputStreamReader read = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(read); System.out.println("Type a num: "); int n = Integer.parseInt(in.readLine()); int pro = 1,i,d; for (; n != 0; ) { d = n%10; if (d == 0) { break; } pro = pro * d; n = n/10; } System.out.println("Product: "+pro); }}
添加回答
举报
0/150
提交
取消