Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, m, a, b, k;
- bool flag=false, check;
- cin>>a>>b;
- for(int i=a; i<=b; i++)
- {
- n=i;
- m=n*n;
- k=0;
- while (n>0)
- {
- if (n%10==m%10)k++;
- m /= 10;
- n /= 10;
- k--;
- }
- if (!k){check=true;}
- else{check=false;}
- if(check==true)
- {
- cout<<i<<" ";
- flag=true;
- }
- }
- if(!flag)
- cout<<0<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement