Social Icons

Tuesday, 18 February 2014

Program to reverse a string

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

void main()
{
clrscr();
char a[20],a1[20];
int i,j;
cout<<"\n Enter a String : ";
gets(a);
cout<<"\n\t Reverse of string is : ";

for(i=0;a[i]!='\0';++i);
for(j=i-1;j>=0;--j)
cout<<a[j];
getch();
}


                                                        Output

No comments:

Post a Comment