Sunday, April 24, 2016

UVA 11461 : Square Numbers - Solution

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

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,