R Program to find the square root of a number


In this program, You will learn how to find the square root of a number in R.


result = sqrt(number)

8 = sqrt(64)

Example: How to find the square root of a number in R

{
  num <- readline(prompt = "Enter a number :")

  num <- as.integer(num)

  result = sqrt(num)

  print(paste("Square root is :", result))
}

Output:

Enter a number :64
[1] "Square root is : 8"