sahajjain01

Display a string reversed.

Sep 13th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. //Program to display a string reversed.
  2. #include<conio.h>
  3. #include<iostream.h>
  4. #include<stdio.h>
  5.  
  6. void main()
  7. {
  8.     clrscr();
  9.     char a[80];
  10.     cout<<"Enter a string: ";
  11.     gets(a);
  12.     for(int i=0;a[i]!='\0';i++);
  13.     for(int j=i;j>=0;j--)
  14.     cout<<a[j];
  15.     getch();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment