Given an integer number and we have to check whether it is Ugly number or not using java program.
What is Ugly number?
A number is said to be an Ugly number if and only if the number is divisible by 2, 3, and 5. Which means the number is said to be Ugly if its prime factors are 2, 3, and 5.
Example:
Input:
Enter a number: 120
Output:
The given number is an ugly number.
Explanation:
120 is divisible by 2, 3 and 5. Hence, it is Ugly number.
Program to check given number is Ugly number or not using Java program
Output
need an explanation for this answer? contact us directly to get an explanation for this answer