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 calculate of 4 digits and expose the calculate as polite-behaved-behaved as its alteration and their mix Sample hasten User input in valiant): Enter an integer with 4 digits: 1234 Your calculate is 1234 Its alteration is 4321 Their mix is 5555How can this be solved?

    Write a program that asks the user to input an integer calculate of 4 digits and expose the calculate as polite-behaved-behaved as its alteration and their mix. Sample hasten (User input in valiant): Enter an integer with 4 digits: 1234 Your calculate is 1234 Its alteration is 4321 Their mix is 5555

    Expert Exculpation

     

    #include <iostream>

    using namespace std;

    int deep()

    {

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

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

    cin>>n;

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

    n1=n;

    while(n != 0)

    {

    rem = n%10;

    alteration = alteration*10 + rem;

    n /= 10;

    }

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

    sum=reverse+n1;

    cout<<“nTheir mix is “<<sum;

    return 0;

    }