Monday, October 17, 2011

C++ program to print reverse of a string


//C++ program to print reverse of a string
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i;
char string[20];
cout<<"Enter A String\n";
gets(string);
for(i=0;string[i]!='\0';i++);
for(i=i-1;i>=0;i--)
{
cout<<string[i];
}
getch();
}


Output:


No comments:

Post a Comment