Answer to Question #100802 in C++ for zahra

Question #100802
Write a program that will display all numbers multiple of 7 which are between 1 and 100 and display the cumulative sum as well as the final sum.
1
Expert's answer
2019-12-27T02:13:48-0500

#include <iostream>

using namespace std;


int main()

{

int sum = 0;

for(int i=1; i<100; i++){

if(i%7 == 0){

sum += i;

cout << "multiple of 7: " << i << " cumulative sum: " << sum << endl;

}

}

cout << "final sum: " << sum << endl;

}

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS