public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int i=0;
int sum=0;
while (true) {
i++;
if(i%3==0&&i%7==0)
sum+=i;
if(i>1000)
break;
}
System.out.println(sum);
}
}
这是JAVA的
int i = 0, sum = 0;
while (++i <= 1000) {
if (0 == i % 3 && 0 == i % 7) {
sum += i;
}
}
System.out.println(sum);
#include
void main()
{
int n=1,sum=0;
while(n<=100)
{
if(n/=0