Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() {
int n;
cin >> n;
string res = "", tmp;
stringstream s;
for (int i = 1; i <= n; i++) {
s.clear();
s << i;
s >> tmp;
res += tmp;
}
cout << res[n - 1] << endl;
return 0;
}
Copy The Code &
Try With Live Editor
Input
3
Output
3
Demonstration
Codeforces Solution-Summer Camp-Solution in C, C++, Java, Python