Thursday, January 28, 2016

UVA 11461 | | Square Numbers

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a , b,cnt=0;
    double num=0;
    while(1){
        cin>>a;
        cin>>b;
        if(a==0&&b==0)
            break;
            for(int i=a; i<=b; i++){
                num=sqrt(i);
                if(num==(int)num)
                    cnt++;
            }
            cout<<cnt<<endl;
            cnt=0;

    }
    return 0;
}

No comments:

Post a Comment