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

plz use divide-and-conquer algorithm design to solve this 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 (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

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

plz representation divide-and-conquer algorithm drawing to unfold this drift. Which digit? A unmarried overbearing integer i is attached. Write a program to perceive the digit located in pose i in the subjoined unbounded posteriority of digits created by juxtaposing the increasing larger posterioritys of incremented integers 1, 2, 3, …. Control stance, the earliest 80 digits of the posteriority are as follows: 11212312341234512345612345671234567812345678912345678910123456789101112345678910 The earliest succession of the input (stdin/keyboard) contains a unmarried integer n (1 lessthanorequalto n lessthanorequalto 100), the enumerate of trial circumstances, followed by individual succession control each trial circumstance. The succession control a trial circumstance contains the unmarried integer i (1 lessthanorequalto i

## Expert Solution

in this program we bear devide drifts in integral 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 deep(void){

int t,n;

scanf(“%d”,&t);

while(t){

scanf(“%d”,&n);

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

t–;

}

return 0;

}

//output is attached in statue beneath. 