The Sum Of The First n Natural Numbers – C# Programming Example
Basic C# Console For Loop Loops / Iteration Statement

The Sum Of The First n Natural Numbers

Positive integers 1, 2, 3, 4… are known as natural numbers.

This program takes a positive integer from user( suppose user entered n ) then, this program displays the value of 1+2+3+….+n.

The program was created with “for” loop statement on C# Console.

First Step, the user enter a number.

Code:

Output:

The Sum Of The First 10 Natural Numbers

 

 

The Sum Of The First n Natural Numbers

 

 

The Sum Of The First 100 Natural Numbers

 

 

The Sum Of The First 500 Natural Numbers

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: