package org.circle;
public class Manji {
public static void main(String[] args)
{
for(int a = 0;a<=25;a++){
for(int b=0;b<=33;b++){
int c =100-a-b;
if(a*4+b*3+c*0.5==100){
System.out.println(" "+a+" "+b+" "+c);
}
}
}
}
}
此程序的运行结果为
0 20 80
5 13 82
10 6 84
package org.circle;
public class Manji {
public static void main(String[] args)
{
for(int a = 0;a<=25;a++){
for(int b=0;b<=33;b++){
int c =100-a-b;
if(a*4+b*3+c*0.5==100);{
System.out.println(" "+a+" "+b+" "+c);
}
}
}
}
}
if(a*4+b*3+c*0.5==100);多了个;结果却是:另外一个结果。这是为何? |