q5

时间:2022-11-27 17:00:59

#include<stdio.h>

#include<math.h>

int main()

{

int i,j,k,l=0,n,m;

scanf("%d",&n);

scanf("%d",&k);

m=n;

do{m/=10;

l++;

}while(m);

if(k>0&&k<=l)

printf("%d",n/(int)pow(10,l-k));

if(k<0&&-k<=l)printf("%d",n%(int)pow(10,-k));

if(k==0)printf("%d",n);

if(abs(k)>l)printf("Error");

return 0;

}