I am trying to solve a problem that says:
Write a program that computes the difference between non-negative integers.
Input:
Each line of the input consists of a pair of integers. Each integer is between 0 and 10 raised to 15 (inclusive). The input is terminated by end of file.
Output:
For each pair of integers in the input, output one line, containing the absolute value of their difference.
Here is my solution:
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int x;
int y;
int z;
cin >> x >> y;
if(x && y <= 1000000000000000){
z=x-y;
cout << std::abs (z);
}
}
But the problem is my answer is wrong, please help me correct my answer and explain why it was wrong.