Ugly Number

1. You are given a number N.
2. You have to find Nth ugly number.
3. Ugly number is defined as the number whose prime factors are only 2,3 and 5.
4. First eleven ugly numbers are -> 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15.

Assumption -> 1 is the first ugly number.
Input Format
A number N
Output Format
A number representing Nth ugly number.
Question Video
Constraints
1 <= N <= 10^4
Sample Input
4
Sample Output
4


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name