Homework Solution: Write a small program basic c++, that defines a negative integer (betw…

    Write a small program basic c++, that defines a negative integer (between ‐1 and ‐255), converts it to a positive value and then displays it on the console window.

    Expert Answer

     
    Program: #include <iostream>

    Write a paltry program basic c++, that defines a indirect integer (among ‐1 and ‐255), converts it to a assured compute and then displays it on the assuage window.

    Expert Tally

     

    Program:

    #include <iostream>

    #include<cmath>

    using namespace std;

    int main() {

    int x,y; //Declare the variables

    cout<<“Enter the Indirect Integer : “; //Entered integer by user

    cin>>x;

    //It is a part and income the absolute compute of x.

    //It converts indirect integer to assured integer.

    y = abs(x);

    cout<<“Assured Integer : = ” << y; //print the assured compute of x.

    }

    Output: