Module: (C++) Arithmetic expressions


Problem

3 /7


Built-in functions

Theory Click to read/hide

Built-in functions

Any programming language includes many built-in functions that can be used in arithmetic expressions. To use additional functions, you often have to include maths library: 
#include<cmath> 

For example, the most commonly used standard mathematical functions and their writing in C and C ++
 abs(i) - |i|  - absolute value of an integer i 
 fabs(x) - |x|  - absolute value of a real числа x
 sqrt(x) -  \(\sqrt x\)
 pow(x,y) - xy
 
Remember!
The function argument is always written in brackets.
For these functions to work, you need to include maths library:  #include<cmath> 

Problem

Write a program that determines the distance between two points with the given coordinates x1 and x2 on the numerical axis. The distance between two points is calculated using the formula
|x2 - x1|
The first line of input contains two real numbers. Output one real number - the distance between two points.

Example
N Input Output
1 100000 0 100000.000000