0
Can someone help me how to program C++ The sum of the first 10 natural numbers?
https://code.sololearn.com/cFzulHmLc44C/?ref=app https://code.sololearn.com/cFzulHmLc44C/?ref=app
8 Answers
+ 9
I don't see anything wrong with your code. What's the problem?
+ 3
the sum of the first n consecutive numbers is n*(n+1)/2
get first link is how that formula was determined, so that you don't have to memorize it, you'll be able to deduce it yourself.
+ 1
Okay, thank you!
+ 1
there's a formula for the sum of a series of consecutive numbers, so instead of a for loop, you could have one expression
0
Can you teach me, please
0
get, what link is that?
0
"Write a program that adds the numbers until user enters 0." How to program this?