Number series program

In this blog, we are going to code different series that usually asked. Many of us get confused between loops and conditions. And it is also one of the most asked interview questions.
 
Number series program

In the table given below, we have listed out various number series program.

Note: If you are new to C# and Console Application. Try to code First C# Program

Note: Read articles on how to use Loops and Conditions.

Let’s find out a simple and easy way to code these pattern.

S.no.
Number Series
1.     

1 + 2 + 3 + 4 + 5 + ... + n

Output
Value of n: 5
Sum: 15

Click to view source code

2.     

(1*1) + (2*2) + (3*3) + (4*4) + (5*5) + ... + (n*n)

Output
Value of n: 5
Sum: 55

Click to view source code

3.     

(1) + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n)

Output
Value of n: 5
Sum:35

Click to view source code

4.     

0, 1, 1, 2, 3, 5, 8, 13, 21,......

Enter value of n: 6
Fibonacci series:
0 1 1 2 3 5

Click to view source code



For any query, comment us below.




Click
imagination hunt to read latest blogs.

Keep learning and sharing...

Comments

Popular posts from this blog

SSC CGL 2016 Tier-1 Marks / Result

DATA TYPES IN C#

Pattern printing program

IS STRING MUTABLE OR IMMUTABLE IN .NET?

Top Mutual Funds

SSC CGL 2017 TIER 2 RESULT OUT

JUST IN TIME (JIT)

Can we have multiple Main methods in one class

TOP 15 VISUAL STUDIO SHORTCUT KEYS

Top 10 Interview Tips and Questions