Thursday, December 9, 2010

to reverse of the String

the Program to reverse the String is as follows..


#include
#include
main()
{
char str[50],revstr[50];
int i=0,j=0,a;
printf("Enter the string to be reversed : ");
scanf("%s",str);

a=strlen(str);

for(i=a-1;i>=0;i--)
{
revstr[j]=str[i];
j++;
}

revstr[j]='\0';

printf("Input String : %s",str);
printf("\nOutput String : %s",revstr);

getch();

}




thanks,
Tushar Khoje



Download RealPlayer for FREE

No comments:

Post a Comment