public class Solution { public bool IsUgly(int num) { if(num <=0) return false; if(num==1) return true; while(num/2*2==num){ num = num/2; } while(num/3*3==num){ num = num/3; } while(num/5*5==num){ num = num/5; } return num==1?true:false; } }
public class Solution { public bool IsUgly(int num) { if(num <=0) return false; if(num==1) return true; while(num/2*2==num){ num = num/2; } while(num/3*3==num){ num = num/3; } while(num/5*5==num){ num = num/5; } return num==1?true:false; } }