#include<iostream>
#include<string.h>
#include<conio.h>
using namespace std;
int main()
{
char str[70];
char temp;
int i,n=0;
cout<<"\nEnter the string:";
gets(str);
for(i=0;str[i]!='\0';i++)
n++; //To find the length of string.
for(i=0;i<n/2;i++)
{
temp=str[i];
str[i]=str[n-i-1];
str[n-i-1]=temp;
}
cout<<"\nThe reversed string is:";
cout<<str;
getch();
}
OUTPUT

No comments:
Post a Comment