leetcode 263

 1 class Solution {
 2 public:
 3     bool isUgly(int num) {
 4         if(num==0)return false;
 5         while(num%2==0) 
 6         num/=2;
 7         while(num%3==0)
 8         num/=3;
 9         while(num%5==0)
10         num/=5;
11         if(num==1)
12         return true;
13         return false;
14     }
15 };
原文地址:https://www.cnblogs.com/thefirstfeeling/p/5752731.html