write a C++ program to find the sum of n natural numbers using for loop
Answers
Answered by
2
At 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+.
Hope it helps you
Answered by
0
Answer:
55
Explanation:
Attachments:
Similar questions