Contact Learn C
Copy

Program 87:To print the reverse of given string

Program 87:
 
#include<stdio.h>
#include<string.h>
main()
{
int i,j=0;
char str1[100],str2[100]={0};
printf("Enter a string to get reverse of string\n");
gets(str1);
for(i=strlen(str1)-1;i>=0;i--)
{
str2[j]=str1[i];
j++;    
}
str2[j]='\0';
printf("The reverse of the given string is---> %s\n",str2);

}
Explanation:

Refer to the Previous Program 86:To know whether the given string is Palindrome or not

 Output:

To print the reverse of given string
Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide