import java.io.*;
import java.util.*;
class JPA309 {
public static void main(String argv[]) throws IOException {
Scanner keyboard = new Scanner(System.in);
int sum=0;
int n = keyboard.nextInt();
for(int i=0;i<=n;i++){
if(i%3==0||i%5==0){
if(i%7!=0){
sum+=i;
}
}
}
System.out.println("Answer: " + sum);
}
}
沒有留言:
張貼留言