View Code of Problem 52

#include  <stdio.h>
#include  <stdlib.h>
#include  <math.h>
#include  <string.h>


char *strrever(char *s)
{
	char tmp;
	int i;
	int j = strlen(s)-1;
	for (i=0;i<=j;i++,j--) 
	{
		tmp = s[i];
		s[i] = s[j];
		s[j] = tmp;
	}

	return s;
}

int main()
{
	char s[1000];
	int i,j,n;

	while (gets(s)!=NULL)
	{
		printf("%s\n",strrever(s));
	}
	
	return 0;
	
}

Double click to view unformatted code.


Back to problem 52