#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-08-16 17:01:05
#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;
}