逆数1#include<stdio.h>
int main(void)
{
int initial_value;
scanf("%d",&initial_value);
int fun(int value);
fun(initial_value);
return 0;
}
int fun(int value)
{
int ret;
int lel;
ret = value / 10;
lel = value % 10;
if (ret != 0){
fun(ret);
}
printf("\n");
}
逆数2
#include<stdio.h>
#include<string.h>
int main(void)
{
char str[80];
char reverse[80];
scanf("%s",str);
int len = strlen(str);
int num = 0;
for(int i=len-1;i>=0;i--)
{
reverse[num++] = str[i];
}
reverse[num] = 0;
puts(reverse);
}
<script type="text/javascript" id="wumiiRelatedItems"> </script>