WAP TO REVERSE A STRING
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
Void main()
{
char str[80],rev[80];
int i,j,k;
clrscr();
cout<<”Enter the string:”;
gets(str);
for(i=0;str[i]!=’\0’;i++)
for(j=i-1;k=0;j>=0;--j;k++)
rev[k]=str[j];
rev[k]=’\0’;
cout<<”\n String in reverse order
is:”;
puts(rev);
getch();
}
Comments
Post a Comment