E. Absolute Value
Problem Setup
- login to CS50 IDE
- write
cdin the terminal to go to the home directory - write
mkdir absoluteto create a folder calledabsolute - write
cd absoluteto go to theabsolutefolder - write
code absolute.cppto create a file calledabsolute.cppand open it in the editor
Problem
You are given two integers \(a\) and \(b\). Print the absolute value of \(a - b\).
Input
One line containing two integers \(a\) and \(b\) where \(1 \leq a, b \leq 10^6\).
Output
Print the absolute value of \(a - b\).
Examples
Example 1:
Input:
4 7
Output:
3
Example 2:
Input:
9 2
Output:
7
Example 3:
Input:
5 5
Output:
0
Test Your Code
Make sure you are in the absolute directory, then run the following command:
check50 iti-technical-team/problemset/2026/1/absolute
Submit Your Code
Make sure you are in the absolute directory, then run the following command:
submit50 iti-technical-team/problemset/2026/1/absolute