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
Math,
14 days ago
Physics,
14 days ago
Computer Science,
29 days ago
English,
29 days ago
Math,
8 months ago