Structure Point: distance to the origin
Rust
Easy
structs
Task «Structure Point: distance to the origin»
Define a structure Point with fields x and y (integers). Write a program that reads integers x and y, creates an instance of Point, calculates the distance from the point to the origin (0,0) using the formula sqrt(x*x + y*y), and outputs the result with an accuracy of two decimal places.
Input Format
Two integers x and y, separated by a space.
Output Format
One real number — the distance, rounded to two decimal places.
Examples
Example 1
INPUT
3 4
OUTPUT
5.00
Example 2
INPUT
5
1 2 3 4 5
OUTPUT
3.00
Example 3
INPUT
0 0
OUTPUT
0.00
Example 4
INPUT
0
OUTPUT
0.00
main.rs