GeeksforGeeks Solution For Hard Domain .Below You Can Find The Solution Of School Basic ,Easy ,Medium . Or Hackerrank Solution You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers
Problem :- Nth digit in sequence
Submit Your Solution :- Click Here
Solution :-
#include <iostream>
using namespace std;
int main()
{
string fib;
int M=100000;
for (int i =1;i<=M;i++)
{
fib+=to_string(i);
}
int t, n;
cin >> t;
while(t--)
{
cin >> n;
cout <<fib[n-1] << endl;
}
}
Output:-
0 Comments: