Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

hi my friend. please help me to this question into the c++. please. tnx ........

ID: 3534099 • Letter: H

Question

hi my friend. please help me to this question into the c++.

please. tnx

..........................................................................................


Given an infinite sequence A with A[N] (N>=1) being the smallet multiple of 4 that being with N, concatenate digits of A[N] to creat an infinite string S. chuck Norris can do this for in his spare time.


what is the Kth digit in S?

Specificaly, sequence begins as 12,20,32,4,52,60,...,

resulting in S="1220324560...".

INPUT FORMAT:

Number of cases, each case contains positive integer K(K<=10^15). Last case is fallowed by the line containing a single zero.


OUTPUT FORMAT:

For each test case, print the Kth digit of S on seprate line.

Explanation / Answer

#include<iostream>

using namespace std;

int main()

{

long long int *s=new long long int();

long long int *a=new long long int();

int n=1,i=0,j=0,k,p,q;

cout<<"Enter numbers you want to concatenate (enter to 0 to stop)"<<endl;

while(1)

{

j=0;

cin>>n;

if(n==0)

break;

while(n>0)

{

k=n;

a[j++]=k;

n=n/10;

}

for(p=j-1;p>=0;p--)

{

s[i++]=a[p];

}

}

cout<<"Enter kth position"<<endl;

cin>>q;

cout<<s[q]<<endl;

return 0;

}