I'm new to Java and I'm just trying to run a simple program using eclipse that takes numbers that are factors of 3 or 5 through 0 to 1000 and adds them all together. I try to run the code, but the program just terminates after a second of running and displays nothing on my console. Here's my code.
public class PrimeSum {
public static void main(String args[]){
}
private double Num= 0.0;
private double sum = 0.0;{
for(int i=0;i<1001;i++){
Num = i;
if(i % 3 == 0.0){
sum += i;
if(i % 5 == 0.0){
if(i % 3 != 0.0){
sum += i;
}
}
}
}
System.out.println("The total is "+ sum);
}
Can someone tell me why this is, I've been searching for these past 2 hours and come up with nothing.