PRF0102 - sqrt

no tags 

Write a program that allows user to enter any number named n and then calculates square root of the number entered. Before calculating the square root, the program needs to check whether the input number is negative or not.

Hint: use the function double sqrt (double n) of the math.h library to calculate the square root of the parameter n.

Example 1:

Please enter any number: -2

Accept positive number only!

Example 2:

Please enter any number: 15

Square root of 15.000000 is 3.872983

Example 3:

Please enter any number: 0

Square root of 0.000000 is 0.000000

Input

Allow user entry a number

Output

Calculates square root of the number entered and show result

Example

Input:
6

Output:
Square root of 6.000000 is 2.449490

hide comments
Mostafa 36a2: 2022-09-11 12:37:06

Note that you should output "Please enter any number: " also.


Added by:khanhvh
Date:2020-10-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:PRF