My orders
How it works
Examples
Reviews
Blog
Homework Answers
Submit
Sign in
How it works
Examples
Reviews
Homework answers
Blog
Contact us
Submit
Question #3330
Write a program to print the sum of the n even numbers by using for loop.
Expert's answer
#include <iostream>
using namespace std;
int main()
{
const int n = 3;
int sum = 0;
for (int i = 1; i <= n; ++i) {
& sum += 2*i;
}
cout << "The sum is " << sum << endl;
return 0;
}
Our fields of expertise
Programming
Math
Engineering
Economics
Physics
LATEST TUTORIALS
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
#339914
on Dec 2023
Read all reviews >>