Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2,
Write a C program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Write a method isUgly that takes a integer variable as parameter, and return a boolean variable, true if it is ugly, and false if it is not.
Note that 1 is typically treated as an ugly number.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started