60 511
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #24157 in C++ for OMAR ALMUTAIRI

Question #24157
Q2: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Write an algorithm to Find the sum of all the multiples of 3 or 5 below 1000.
Expert's answer
#include <conio.h>
#include <iostream>

using namespace std;

void main()
{
long sum = 0;
for (int number = 3; number < 1000; number++)
if ((number % 3 == 0) || (number % 5 == 0))
sum += number;
cout << "The sum of the multiples of 3 or 5 below 1000 is: " << sum << endl;
_getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions