Powered by Blogger.

C++ Program to Reverse a Number



C++ Program to Reverse a Number


#include<iostream.h>
#include<conio.h>
void main()
{
int num, reverse = 0;
cout<<"Enter any number: ";
cin>> number;
for( ; num!= 0 ; )
{
reverse = reverse * 10;
reverse = reverse + num%10;
num = num/10;
}
cout<<"Reversed Number is: "<<reverse;
getch();
}

Output:

Enter any number: 345
Reverse Number is: 543



facebook
google-plus
twitter
pinterest

No comments :

Post a Comment

HTML Tutorial

images

About Sitesbay

This blog is related to Java Tutorial, C++ Tutorial, C Tutorial, Online Earning tips and more in very simple and easy way. Here i will try to give complete idea related to all new technology.

Java Tutorial

Java is Object oriented programming language, It is more secure and high performance language.

C++ Tutorial

C++ is also Object oriented programming language, It is more simple and easy to learn.

 
https://sitesbay.blogspot.com/?utm_medium=d2898efa59afcc0bc411921036e22b767ca37b09