Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A single positive integer i is given. Write a program to find the digit located in position i in the following infinite sequence of digits
A single positive integer i is given. Write a program to find the digit located in position i in the following infinite sequence of digits created by juxtaposing the increasing larger sequences of incremented integers 1, 2, 3, For example, the first 80 digits of the sequence are as follows: 11212312341234512345612345671234567812345678912345678910123456789101112345678910 The first line of the input (stdin/keyboard) contains a single integer n (1 lessthanorequalto n lessthanorequalto 100), the number of test cases, followed by one line for each test case. The line for a test case contains the single integer i (1 lessthanorequalto i lessthanorequalto 10^10). There should be one output line per test case containing the digit located in position i. Submission Again we plan to set up test cases for automated marking for this problem. For this assignment name your source code digitE.ext or digitH.ext, where ext denotes one of { java. cpp, cs, py } that indicates java/c++/csharp/python language. Please use just one source file per problem. Here the suffix E of the basename denotes 'E'asy (test data) and H denotes 'H'arder (test data), with 3 and 2 marks given, respectively. (Alternatively, the automarker now handles a single submission for testing both test cases-use filename digit. ext for this feature.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started