You are on page 1of 3

Write a program that reads the inter from the keyboard and the print its

reverse
i.e. if u have entered 1234 program will print 4321.
============================================
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();

long no,op,d1,d2,d3,d4,d5;
char c1,c2,c3,c4,c5;

cout<<"1-Integer Reverse\n\n2-Characters Reverse";


cout<<"\n\nEnter Option No: ";
cin>>op;
switch (op)
{
case 1:
{
clrscr();
cout<<"\nINTEGER REVERSE";
cout<<"\n\nEnter 5 Digit Ineteger: ";
cin>>no;

d1=no/10000;
no=no%10000;
d2=no/1000;
no=no%1000;
d3=no/100;
no=no%100;
d4=no/10;
d5=no%10;

cout<<"\n\nThe Reversed Integer:


"<<d5<<d4<<d3<<d2<<d1;
break;
}

case 2:
{
clrscr();
cout<<"\nCHARACTERS REVERSE";
cout<<"\n\nEnter 5 Characters: ";
cin>>c1>>c2>>c3>>c4>>c5;
cout<<"\n\nThe Reversed is: "<<c5<<c4<<c3<<c2<<c1;
break;
}

default:
{
cout<<"\n\n invalid Entry...";
break;
}
}

getch();
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006