利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。

如题所述

#include "stdio.h"
void palin(int n)
{
char next;
if(n<=1)
{
next=getchar();
printf("\n\0:");
putchar(next);
}
else
{
next=getchar();
palin(n-1);
putchar(next);
}
}
main() //利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。
{
int i=5;
printf("\40:");
palin(i);
printf("\n");
}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答