ProgMe

Task 3

Mar 27th, 2020
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n = 1;
  8.     int k;
  9.     cin >> k;
  10.     k--;
  11.     string s;
  12.     while (s.size() <= k)
  13.     {
  14.         s += to_string(n * n);
  15.         n++;
  16.     }
  17.     cout << s [k];
  18. }
Advertisement
Add Comment
Please, Sign In to add comment