#include <stdio.h>
#include <string.h>
int main( )
{
char string[80];
int n;
gets(string);
n=strlen(string);
while(n--)
printf("%c",*(string+n));
printf("\n");
return 0;
}
扩展资料:
java程序:
import java.util.Scanner;
public class chuan{
public static void main(String args[]){
Scanner sca = new Scanner(System.in);
String str = sca.nextLine();
StringBuffer sb = new StringBuffer(str);
System.out.print(sb.reverse().toString());
}
}