Program to display the reverse of given number(Level-Low)


Program # 9: Reverse a Number

//Program to display the reverse of given number(Level-Low)
#include <iostream.h> 
#include <conio.h>

void main ()
{
clrscr();
unsigned a,u,t,h,b,res; 

cout<<"Enter the year = "; 
cin >> a;

b = a  /1000;
res = a %1000;         // % is used for remainder 
h = resƒ100;

res = res/100;
t = res/10;
res = res/10; 
u = res/1;

cout<<"The reverse number is = "<<u<<t<<h<<b; 

getch();
}

Post a Comment

0 Comments