#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[20],rev[20];
int len,k=0;
cout<<"Enter the string ";
cin.getline(name,20);
for(len=0;name[len]!='\0';len++)
for(i=len;i>=0;i--)
{
rev[k]=name[i];
k++;
}
rev[k]='\0';
cout<<"Reversed string ";
cout.write(rev,20);
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char name[20],rev[20];
int len,k=0;
cout<<"Enter the string ";
cin.getline(name,20);
for(len=0;name[len]!='\0';len++)
for(i=len;i>=0;i--)
{
rev[k]=name[i];
k++;
}
rev[k]='\0';
cout<<"Reversed string ";
cout.write(rev,20);
getch();
}
No comments:
Post a Comment