Answer:
Following are the program in C++ language
#include <iostream> // header file
using namespace std; // namespace std;
int main() // main function
{
int number,n1,rem; // variable declaration
int sum,sum1=0;// variable declaration
cout<<"Enter the number :";
cin>>number;// Read the number
n1=number; // initialized the value of number with the n1
while(n1>0) // iteating the while loop
{
rem=n1%10; // finding the reminder
sum1=10*sum1+rem; // storing the sum
n1=n1/10;
}
sum=sum1+number; // calculate the sum
cout<<"The sum is:"<<sum; // Display sum
return 0;
}
Output:
Enter the number :123
The sum is:444
Explanation:
Following are the Description of the Program
- Read the value of "number" in the "number" variable of int type .
- Initialized the value of "number" in the "n1' variable.
- Iterating the while loop until the n1>0.
- In this loop we reverse the number in the "sum1" variable
- Finally print the sum in the "sum" variable