C語(yǔ)言:求整數(shù)n的逆序數(shù)m
2023-05-30 08:45 作者:wangyanhpa | 我要投稿
#include "stdio.h"
//求整數(shù)n的逆序數(shù)m
int reverse(int n)
{
int m=0,you;
while(n>0)
{
you=n%10;
n=n/10;
m=m*10+you;
}
return m;
}
int main()
{
printf("%d\n",reverse(123));
return 0;
}
標(biāo)簽: