REAL NUMBERS




When working with real numbers, you can use the familiar сmath module, which contains a large number of built-in functions.
When solving problems, one often has to round real numbers to the nearest integer values. There are two functions for this.

REMEMBER
1
with explicit type conversion ( float x=1.5; int y = int (x))  -  the fractional part of the real number is cut off (y = 1) 
2 function floor(x) - returns the value of \(x\) rounded down to its nearest integer \(x\) 
3 function ceil(x) -  returns the value of \(x\)  rounded up to its nearest integer 

Here are the most useful functions contained in the module cmath.

Функция Описание
Округление
round(x)
C++ 11
returns the integral value that is nearest to x, with halfway cases rounded away from zero.
trunc(x)
C++ 11
rounds x toward zero, returning the nearest integral value that is not larger in magnitude than x
floor(x) returns the value of \(x\) rounded down to its nearest integer   floor(1.5) == 1floor(-1.5) == -2
ceil(x) returns the value of \(x\)  rounded up to its nearest integer ceil(1.5) == 2ceil(-1.5) == -1
abs(x) returns the absolute value of x
fabs(x) returns the absolute value of a floating x
Корни, логарифмы
sqrt(x) returns the square root of x.  y = sqrt(x). The function takes a single non-negative argument. If negative argument is passed to sqrt() function, domain error occurs.
pow(x, y) returns the value of x to the power of y. \(x^y\)
log(x) returns the natural logarithm of a number.
exp(x) returns the base-e exponential function of x, which is e raised to the power xex.
Тригонометрия
sin(x) returns the sine of an angle of x radians.
cos(x) returns the cosine of an angle of x radians.
tan(x) returns the tangent of an angle of x radians
asin(x) returns the principal value of the arc sine of x, expressed in radians. In trigonometrics, arc sine is the inverse operation of sine.
acos(x) returns the principal value of the arc cosine of x, expressed in radians. In trigonometrics, arc cosine is the inverse operation of cosine.
atan(x) returns the principal value of the arc tangent of x, expressed in radians. In trigonometrics, arc tangent is the inverse operation of tangent
x) returns the principal value of the arc tangent of y/x, expressed in radians. To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.

Task
Time limit: 1000 ms,
Memory limit: 256 Mb

Write a program that calculates the square root of a number entered from the keyboard, accurate to three decimal places.

Example
N Input Output
1 25 5.000

 

Auto CHOOSE THE PROGRAMMING NECESSARY LANGUAGE!
Attach the program source file:
or enter the source code in the language:

Rules for designing programs and a list of errors during automatic task verification
           

Results: