Source Code:-
-----------------------------------------------------------------------------------------------------------
#include<iostream>
using namespace std;
#include<stdio.h>
#include<string.h>
int main()
{
char str[100],temp;
int i,j=0;
cout<<"Enter the string that you want to reverse:";
gets(str); // gets function for input string
i=0;
j=strlen(str)-1;
while(i<j)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
i++;
j--;
}
cout<<" The Reverse string is: "<<str;
}
--------------------------------------------------------------------------------
Out Put-
No comments:
Post a Comment