class Demo6 {
public static void main(String[] args) {
printSum();
}
public static void printSum() {
int sum = 0;
for (int x = 15; x <= 1005; x++) {
if (x % 5 != 0) {
continue;
}
sum += x;
//System.out.print(x + "、");
}
//System.out.println();
System.out.println("15+25+35+....+1005=" + sum);
}
}
|
|