Given a number n, print the nth even number. The 1st even number is 2, 2nd is 4 and so on.

**Examples:**

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.

## C++

`// CPP program to find the nth even number ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the nth even number ` `int` `nthEven(` `int` `n) ` `{ ` ` ` `return` `(2 * n); ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `int` `n = 10; ` ` ` `cout << nthEven(n); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// JAVA program to find the nth EVEN number ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the nth odd number ` ` ` `static` `int` `nthEven(` `int` `n) ` ` ` `{ ` ` ` `return` `(` `2` `* n); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `main(String [] args) ` ` ` `{ ` ` ` `int` `n = ` `10` `; ` ` ` `System.out.println(nthEven(n)); ` ` ` ` ` `} ` `} ` ` ` `// This code is contributed ` `// by ihritik ` |

*chevron_right*

*filter_none*

## Python3

`# Python 3 program to find the ` `# nth odd number ` ` ` `# Function to find the nth Even number ` `def` `nthEven(n): ` ` ` ` ` `return` `(` `2` `*` `n) ` ` ` `# Driver code ` `if` `__name__` `=` `=` `'__main__'` `: ` ` ` `n ` `=` `10` ` ` `print` `(nthEven(n)) ` ` ` `# This code is contributed ` `# by ihritik ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find the ` `// nth EVEN number ` `using` `System; ` ` ` `class` `GFG ` `{ ` `// Function to find the ` `// nth odd number ` `static` `int` `nthEven(` `int` `n) ` `{ ` ` ` `return` `(2 * n); ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main() ` `{ ` ` ` `int` `n = 10; ` ` ` `Console.WriteLine(nthEven(n)); ` `} ` `} ` ` ` `// This code is contributed ` `// by anuj_67 ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find the ` `// nth even number ` ` ` `// Function to find the ` `// nth even number ` `function` `nthEven(` `$n` `) ` `{ ` ` ` `return` `(2 * ` `$n` `); ` `} ` ` ` `// Driver code ` `$n` `= 10; ` `echo` `nthEven(` `$n` `); ` ` ` `// This code is contributed ` `// by anuj_67 ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

20

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Nth Even Fibonacci Number
- Find Nth even length palindromic number formed using digits X and Y
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Count ways to express even number ‘n’ as sum of even integers
- Average of even numbers till a given even number
- Check if a number has an odd count of odd divisors and even count of even divisors
- Program for nth Catalan Number
- Program to find last two digits of Nth Fibonacci number
- Program to find the nth Kynea number
- Program to find the Nth Harmonic Number
- Program to find the Nth number of the series 2, 10, 24, 44, 70.....
- Program to delete Nth digit of a Number
- Program to find the Nth Prime Number
- Program to find Nth odd Fibonacci Number
- Program for nth Fuss–Catalan Number
- Program to find the Nth natural number with exactly two bits set
- Sum of even numbers at even position
- Print even positioned nodes of even levels in level order of the given binary tree
- Rearrange array such that all even-indexed elements in the Array is even
- Number of digits in the nth number made of given four digits

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.