Ugly Number in Java
Question : Write a program to accept a number and check whether it is Ugly number or not.
Ugly Number : An Ugly number is a positive integer whose prime factors are limited to 2, 3, and 5
First 11 Ugly Numbers : 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15
Example :-
Factors of 12 : 1, 2, 3, 4, 6, 12
Prime Factors of 12 : 2, 3
Prime Factorization : Writing a number as products of its prime factors.
12 : 2 X 2 X 3 = 12
Program to check whether a number is Ugly Number or not :-
Checkout Source Code : Click here
Program Video : Watch Now
Comments