.
Home About-us Privacy Policy Contact-us Services

Wednesday, October 7, 2015

Program to reverse an integer number in c++

ad+1

#include<iostream.h>
#include<conio.h>
void main()
{
int a,d,rev=0;
clrscr();
cout<<"enter the number:";
cin>>a;
while(a>0)
{
d=a%10;
a/=10;
rev=rev*10+d;
}
cout<<"reverse="<<rev;
getch();
}

Output - 

enter the number:876
reverse=678




0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates