Answer to Question #257965 in C++ for Kelvin Tito

Question #257965

Write a C++ program which computes the sum of all even numbers between 1 and 99 using for loop. Write, scan and upload the program. Ensure the program has your registration number and signature.


1
Expert's answer
2021-10-28T01:59:17-0400
#include<iostream>
using namespace std;
int main(){
	int sum = 0 ;
	for(int i=1; i<=99; i++){
		if(i%2==0){
			sum += i;
		}
	}
	cout<<"The sum of all even numbers betweem 1 and 99 is:  "<<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