请问我的For循环中,多了一个分号,这道题的结果就不同,这是为啥?
package shuomac.www;
public class HelloWorld{
public static void main(String[] args) {
int sum = 0;
for (int mashuo =1;mashuo <= 100;mashuo++) {
if (mashuo % 3 != 0);//就是多了这个分号,计算结果是5050,少了这个分号,计算结果就是对的,这是为啥?
{
sum = sum + mashuo;
}
}
System.out.println("The Number Can't divide By 3 Sum is: "+sum);
}
}