# 263. Ugly Number

1，题目要求
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:

1 is typically treated as an ugly number.
Input is within the 32-bit signed integer range.

2，题目思路

3，程序源码

class Solution {
public:
bool isUgly(int num) {
for(int i = 2;i<6 && num!=0;i++)  //对可能输入的0做判断
{
while(num%i == 0)
num = num/i;
}

if(num == 1)
return true;
else
return false;
}
};