View Code of Problem 52

#include<stdio.h>
#include<math.h>
#include<string.h>
#define max 100
int main()
{	
	int n;
	char str[max];
		gets(str);
	//char str[max]="hello";
	//逆序输出
	int l=strlen(str);
	char t;
	int j=0;
	//printf("%s",str);
	for(j=l-1;j>=0;j--){
		printf("%c",str[j]);
	}
	
	
	for(int i=0;i<=l/2;i++){
		t=str[i];
		str[i]=str[l-i-1];
		str[l-i-1]=t;	
	}
//	方法一 
//	for(int i=0;i<=l;i++){
//		if(str[i]!='\0') {
//		printf("%c",str[i]);
//		}	
//	}

//    puts(str);
//	printf("%s",str); 
//	
	return 0;	
} 

Double click to view unformatted code.


Back to problem 52