Uva 11461 Solution

#include<stdio.h>
#include<math.h>
int main()
{
    int a, b, c, count = 0,i,e,t;
    while(scanf("%d %d", &a, &b) && a>0 && b>0)
    {
        count = 0;
        if(a>b)
        {
            t = a;
            a = b;
            b = t;
        }
        for(i=a;i<=b;i++)
        {
            c = sqrt(i);
            e = c * c;
            if(e == i)
            {
                count++;
            }
        }
        printf("%d\n", count);
    }
    return 0;
}

Comments