Computer Science, asked by hitman27, 2 months ago

write a c++ program to print the addition of first five even numbers using for loop.​

Answers

Answered by amansharma9959
1

Answer:

C++ program to calculate sum of first N even numbers - Studyfied ...

Jump to Output — First, we declare one variable ” sum ” with value 0, and then we are going to use this variable to store sum of all even numbers between 1 to N. Now after taking input (N) from user, we have to check if the current variable “i” is even or not inside the loop .

Answered by lTWINKLEl
0

Answer:

the end of the loop, sum will have the right value, so print it. You can try: int sum = startingNumber; for (int i=0; i < positiveInteger; i++) { sum += i; } cout << sum; But much easier is to note that the sum 1+2+

Similar questions