Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Monday, 20 February 2017

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...

No comments:

Post a comment

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...