![]() |
VOOZH | about |
Given a number n, print the nth odd number. The 1st odd number is 1, 2nd is 3, and so on.
Examples:
Input : 3 Output : 5 First three odd numbers are 1, 3, 5, .. Input : 5 Output : 9 First 5 odd numbers are 1, 3, 5, 7, 9, ..
The nth odd number is given by the formula 2*n-1.
Output:
19
Time Complexity: O(1)
Auxiliary Space: O(1)