编辑代码

#include <stdio.h>
//The number is founded the  location
//正整数n的左起第k个数 

int digit(int n ,int k)
{
    int i,temp1,temp2,q;
    temp2=n;
    while(temp2)
    {
        ++q;
        temp2 /=10;
    }
    for(i=0;i<=q-k;i++)
    {
        printf("n is :%d\n",n);
        temp1=n%10;
        n=n/10;
        //printf("%d\n",temp1);
    }
    if(temp1==0) return -1;
    return temp1;
}
int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
	int  i,m;
    i=31415926;
    m=digit(i,6);
    printf("the location  is:%d",m);
	return 0;
}