TheFestFever.com

Our aim is to connect students from campuses all over Delhi by making them aware of all Technical, Cultural, Management fests, workshops, Seminars organized by every college in Delhi.

Join Us Now

Program 28: Write a C++ program to reverse a number.

#include<iostream>
using namespace std;

int main()
{
	int num,sum=0;
	cout<<"\nenter a number : ";
	cin>>num;

	for(int i=num;i>0;i=i/10)
	{
		sum=(sum*10)+(i%10);
	}

	cout<<"\nreverse of the number is "<<sum;
	return 0;
}


If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.