Computer Science, asked by mdfaijan801, 6 months ago

write a program in C++ to print
diffrent of two values.​

Answers

Answered by imtiyazallam
0

Answer:

#include<iostream>

#include <cstdlib>

using namespace std;

int main() {

int a, b;

cout << "Enter 2 numbers" ;

cin >> a;

cin >> b;

cout << "difference between " << a << " and " << b << " is " << abs((a-b)) << endl;

return 0;

}

Explanation:

You might be thinking why I have used abs function near printing statement! It is because if the value of variable b is greater than variable a the result would be negative.

Similar questions