- w是一个大于10的无符号整数,若w是n(n>=2)位的整数,函数求出w的低n-1位的数作为函数值返回。
如输入790404,输出为90404。
#include <stdio.h>
unsigned fun(unsigned w)
{
int i,j=1,k=w;
while(w)
{
i=w%10;
j=j*10;
w=w/10;
}
return k-i*j/10;
}
int main()
{
unsigned x;
printf("enter a unsigned integer number:");
scanf("%u",&x);
printf("the original data is :%d\n",x);
if (x<10) printf("data error!");
else
printf("the result :%u\n",fun(x));
printf("\n");
return 0;
}