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 spread-out the compute as well-behaved-mannered-mannered as its inversion and their consolidate Sample retreat User input in fearless): Enter an integer with 4 digits: 1234 Your compute is 1234 Its inversion is 4321 Their consolidate is 5555How can this be solved?

    Write a program that asks the user to input an integer compute of 4 digits and spread-out the compute as well-behaved-mannered-mannered as its inversion and their consolidate. Sample retreat (User input in fearless): Enter an integer with 4 digits: 1234 Your compute is 1234 Its inversion is 4321 Their consolidate is 5555

    Expert Exculpation

     

    #include <iostream>

    using namespace std;

    int ocean()

    {

    int n,n1, inversion = 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;

    inversion = inversion*10 + rem;

    n /= 10;

    }

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

    sum=reverse+n1;

    cout<<“nTheir consolidate is “<<sum;

    return 0;

    }