Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int k, n, p, m;
- cout << "n=";
- cin >> n;
- p = 10;
- for (k = 1; k <= n; k++) {
- m = k*k;
- if (p < k) p*=10;
- if (m %p==k)
- cout << k << " " << m << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement