Tuesday, 25 August 2015

If a five-digit number is input through the keyboard, write a program to reverse the number.

#include"stdafx.h"
#include<iostream>
usingnamespace std;
void main ()
{
int num,a,b,c,d,e,d1,d2,d3,d4,d5;
 cout<<"Enter a five digit number"<<endl;
 cin>>num;
 a=num/10;
 d1=num%10;
 b=a/10;
 d2=a%10;
 c=b/10;
 d3=b%10;
 d=c/10;
 d4=c%10;
 e=d/10;
 d5=d%10;
 cout<<"The reverse num is "<<d1<<d2<<d3<<d4<<d5<<endl;
system("pause");
}

No comments:

Post a Comment