class Demo {
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i <=100 ; i++) {
if (i % 2 == 0) {
sum += i;
}
}
System.out.println("sum = " + sum);
}
}
i=1 to 100
n=0
if int(i/2)=i/2
n=n+i
i=i+1
?n
endif
这是vfp的,不知java是否适用.
int main()
{
int sum=0;
for(int i=1;i<=50;i++)
sum+=i*2;
cout<