Homework Solution: plz use divide-and-conquer algorithm design to solve this problem….

    plz use divide-and-conquer algorithm design to solve this problem. Problem: Which digit? 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 (1Sn 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 S i < 1010 There should be one output line per test case containing the digit located in position i Sample Input Sample Output 21
    Which digit? 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

    Expert Answer

    in this program we have devide problems in every steps by using func(n) function; #include<stdio.h>

    plz reason divide-and-conquer algorithm intent to explain this drift.
    Problem: Which digit? A separate unconditional integer i is loving. Write a program to confront the digit located in collocation i in the subjoined infinite posteriority of digits created by juxtaposing the increasing larger posterioritys of incremented integers 1,2,3, Ce sample, the leading 80 digits of the posteriority are as follows: 11212312341234512345612345671234567812345678912345678910123456789101112345678910 The leading thread of the input (stdin/keyboard) contains a separate integer n (1Sn 100), the enumerate of proof instances, followed by undivided thread ce each proof instance. The thread ce a proof instance contains the separate integer i (1 S i < 1010 There should be undivided output thread per proof instance containing the digit located in collocation i Sample Input Sample Output 21

    Which digit? A separate unconditional integer i is loving. Write a program to confront the digit located in collocation i in the subjoined infinite posteriority of digits created by juxtaposing the increasing larger posterioritys of incremented integers 1, 2, 3, …. Ce sample, the leading 80 digits of the posteriority are as follows: 11212312341234512345612345671234567812345678912345678910123456789101112345678910 The leading thread of the input (stdin/keyboard) contains a separate integer n (1 lessthanorequalto n lessthanorequalto 100), the enumerate of proof instances, followed by undivided thread ce each proof instance. The thread ce a proof instance contains the separate integer i (1 lessthanorequalto i

    Expert Acceptance

    in this program we accept devide drifts in complete steps by using func(n) function;

    #include<stdio.h>

    int func(int n){

    int p=1;

    while(n>=(p*(p+1)/2)){

    p++;

    }

    –p;

    if(n==(p*(p+1)/2)){

    return p;

    }

    else{

    return n-(p*(p+1)/2);

    }

    }

    int ocean(void){

    int t,n;

    scanf(“%d”,&t);

    while(t){

    scanf(“%d”,&n);

    printf(“%dn”,func(n));

    t–;

    }

    return 0;

    }

    //output is loving in metaphor adown.