Followers

Monday, March 12, 2012

REVERSING A STRING-WITHOUT USING ANOTHER STRING

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

void main()
{
  char strng[25];
  int len;
  cout<<"enter a string : ";
  gets(strng);
  len=strlen(strng);
  cout<<"\n\nreverse : \n";
  for(int i=len-1; i>=0 ; i--)
    cout<<strng[i];
  getch();
}
.................................................................
OUTPUT :(click to enlarge the image)

No comments:

Post a Comment