подходит ли этот алгоритм для проверки конечного десятичного числа?

int is_ter(int x)
{
    //it is not a TWOs nor a FIVEs and not 1.0
g:  
    if(x%2 !=0 && x%5 !=0 && x!=1 )
        return 0;
    // make sure it is 1.0
    if(x%2 !=0 && x%5 !=0 && x==1 )
        return 1;
    //check if it is a two
    if(x%2==0){
         x/=2;
         goto g;
    }
    if(x%5==0)
    {
        x/=5;
        goto g;
    }
}
0
задан zmbq 22 July 2012 в 12:05
поделиться