Java Program to find the sum of all the multiples of 3 and 5 below 1000 on June 18, 2021 Get link Facebook X Pinterest Email Other Apps // Program by Akash Tripathi (@proakash256) public class Multiples_3_5{ public static void main(String args[]) { int sum = 0; for(int i = 1; i < 1000; i = i + 1) { if(i % 3 == 0 || i % 5 == 0) { sum = sum + i; } } System.out.printf("%d" , sum); }} Comments
Comments
Post a Comment