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: , ,

Related Posts:

  • 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;  … Read More

0 comments:

Post a Comment

Copyright © 2025 UPgradeCODING | Powered by Blogger