Computer Science, asked by smileyeshaq9340, 1 year ago

Program to find the square root of a number in java

Answers

Answered by Rajdeep11111
4
HEYY FRIEND!

Program to find square root of a number?

Here's your code:

import java.util.*;
class SquareRoot
{
public static void main (String args[])
{
Scanner sc = new Scanner (System.in);
System.out.print("Enter the number: ");
int num = sc.nextInt();
double ans;
ans = Math.sqrt(num);
System.out.println("Square root of " + num + " is: " + ans);
}
}


THANKS (^_^)
Similar questions