Advertisement
Babul_420

uva problem 11461 Square Numbers solution

Apr 25th, 2018
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6.     double d;
  7.     int a, b;
  8.     while(scanf("%d%d", &a, &b) && ( a>0 && b>0)){
  9.  
  10.     int c=0;
  11.     if( a>b){ int temp;
  12.     temp=a;
  13.     a=b;
  14.     b=temp;
  15.     }
  16.     for(int i=a;i<=b;i++){
  17.         d=sqrt(i);
  18.         if(d==int(d)){
  19.             c++;
  20.         }
  21.  
  22.     }
  23.     printf("%d\n",c);
  24.  
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement