Hashmat the Brave warrior
input: standard input
output: standard output
Hashmat is a brave warrior who with he group of young soldiers moves from one place to another to fight against he oppon Ents. Before fighting he just calculates one thing, the difference between his soldier number and the opponent ' s soldier number. From the difference he decides whether to fight or not. Hashmat ' s soldier number is never greater than he opponent.
Input
The input contains the numbers in every line. These the numbers in each line denotes the number of soldiers in Hashmat's army and his opponent ' s army or vice versa. The input numbers is not greater than 2^32. Input is terminated by End of File.
Output
For each line of input, print the difference of number of soldiers between Hashmat ' s army and his opponent ' s army. Each output should is in the seperate line.
Sample Input: 10 12
10 14
100 200
Sample Output: 2
4
100
Parsing: The title meaning is the absolute value of the output two number note the data type of the number, need to use a long long, and note the input and output of long long, with LLD instead of I64D.
#include <stdio.h>
#include <stdlib.h>
int main () {
long long m, N;
while (~SCANF ("%lld%lld", &m, &n)) {
if (M >= N) printf ("%lld\n", m-n);
else printf ("%lld\n", n-m);
}
return 0;
}