Computer Science, asked by creatingmyselfrn, 8 months ago

find the square root of all numbers, 1 to n using java math function
(inputs are using scanner class)

Answers

Answered by Anonymous
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