Given a number n, print the nth even number. The 1st even number is 2, 2nd is 4 and so on.
Input : 3 Output : 6 First three even numbers are 2, 4, 6, .. Input : 5 Output : 10 First five even numbers are 2, 4, 6, 8, 19..
The nth even number is given by the formula 2*n.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to calculate the number of odd days in given number of years
- Program to Convert Octal Number to Binary Number
- Program to Convert BCD number into Decimal number
- C++ Program for How to check if a given number is Fibonacci number?
- Program to check whether a number is Proth number or not
- Program to check whether the given number is Buzz Number or not
- Program for n-th odd number
- Program for nth Catalan Number
- Program for Sum of the digits of a given number
- Program for factorial of a number
- C/C++ Program for n-th Fibonacci number
- Program to check if N is a Icosidigonal Number
- Program to check Plus Perfect Number
- Program to find the Nth Harmonic Number
- Program to convert a given number to words | Set 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.