#include<stdio.h>
int n;
int zhd(int n)
{
if(n<10)
return n;
else
return zhd(n%10);
}
int main()
{
int n;
scanf("%d",&n);
while(n!=0)
{
printf("%d",zhd(n));
n=n/10;
}
return 0;
}
时间: 2024-11-05 18:11:06
#include<stdio.h>
int n;
int zhd(int n)
{
if(n<10)
return n;
else
return zhd(n%10);
}
int main()
{
int n;
scanf("%d",&n);
while(n!=0)
{
printf("%d",zhd(n));
n=n/10;
}
return 0;
}