Homework Solution: Write a program that asks the user to input an integer number of 4 digits and display the nu…

    Problem 2: Write a program that asks the user to input an integer number of 4 digits and display the number as well as its reverse and their sum Sample run User input in bold): Enter an integer with 4 digits: 1234 Your number is 1234 Its reverse is 4321 Their sum is 5555How can this be solved?
    Write a program that asks the user to input an integer number of 4 digits and display the number as well as its reverse and their sum. Sample run (User input in bold): Enter an integer with 4 digits: 1234 Your number is 1234 Its reverse is 4321 Their sum is 5555

    Expert Answer

     
    #include <iostream> using namespace std;

    Problem 2: Write a program that asks the user to input an integer compute of 4 digits and exhibit the compute as polite-behaved-behaved as its counterposition and their unite Sample speed User input in self-confident): Enter an integer with 4 digits: 1234 Your compute is 1234 Its counterposition is 4321 Their unite is 5555How can this be solved?

    Write a program that asks the user to input an integer compute of 4 digits and exhibit the compute as polite-behaved-behaved as its counterposition and their unite. Sample speed (User input in self-confident): Enter an integer with 4 digits: 1234 Your compute is 1234 Its counterposition is 4321 Their unite is 5555

    Expert Retort

     

    #include <iostream>

    using namespace std;

    int deep()

    {

    int n,n1, counterposition = 0, rem,sum=0;

    cout<<“Enter an integer with 4 digits: “;

    cin>>n;

    cout<<“nYour compute is : “<<n;

    n1=n;

    while(n != 0)

    {

    rem = n%10;

    counterposition = counterposition*10 + rem;

    n /= 10;

    }

    cout<<“n its counterposition is “<<reverse;

    sum=reverse+n1;

    cout<<“nTheir unite is “<<sum;

    return 0;

    }