183k views
2 votes
Write the sum of first n natural numbers.​

User Ceebreenk
by
5.5k points

1 Answer

3 votes

The sum of the first n natural number = n * (n+1) / 2, for n a natural number.

For example, you want to calculate the sum and average of any five numbers entered by the user. i.e., If you want to calculate the sum and average or percentage of multiple user-entered numbers, then please refer to the following program.

User Asvd
by
4.7k points