10 Mar 2013

Reverse string

/*

program to reverse a string....

*/

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

void main()
{
clrscr();
 

char a[80];
int i,k;
 

cout<<"Enter the string:";
gets(a);
k=strlen(a);
cout<<"This string has "<<k<<" letters"<<endl;
cout<<"Output string is:";
for(i=k-1;i>=0;i--)
 {
  cout<<a[i];
 }
getch();
}

Categories: , ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger