find the square root of all numbers, 1 to n using java math function
(inputs are using scanner class)
Answers
Answered by
1
Explanation:
import java.util.*;
class Squ_root
{
public static void main (String args [])
{
Scanner sc=new Scanner (System.in);
System.out.println("enter the value of n");
int n=sc.nextInt();
for(int i=1;i<=n;i++)
{
System.out.println("the square root of"+i+"is"+Math.sqrt(i));
}
}
}
Some additional information:
*Java is a high level language.it is an object oriented language.
*java has a lot of inbuilt function to ease our works.
*the default package of java is java.io package.
*java is one of the most popular languages used in the world.
Attachments:
Similar questions
Math,
4 months ago
Accountancy,
4 months ago
English,
9 months ago
History,
9 months ago
Biology,
1 year ago
Social Sciences,
1 year ago