Write a 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.
Note that 1 is typically treated as an ugly number.
解法1:暴力法
按照题意,ugly number一定是1,2,3,5几个数的乘积。那么用number不停的去整除2,3,5,如果发现不能整除,则不是ugly,如果能整除则继续直到为1或者出现不能整除的数为止。
C++
Java