Program Based On Inbuilt Function

WAP to accept two numbers find the largest and print its square root. And print the square of the smaller one.


public class inbuilt2
public static void main(String args[])throws IOException
InputStreamReader read = new InputStreamReader(;
BufferedReader in = new BufferedReader(read);
double square=0;

System.out.println("Enter the first number");
int one=Integer.parseInt(in.readLine());
System.out.println("Enter the second number");
int two=Integer.parseInt(in.readLine());

int large=Math.max(one,two);
int less = Math.min(one,two);
double squareroot=Math.sqrt(large);

System.out.println("The square root of the larger number is = "+squareroot);
System.out.println("The square of the smaller number is = "+square);

Program Execution:

Enter the first number
Enter the second number
The square root of the larger number is = 10.0
The square of the smaller number is = 36.0
Post a Comment

All Rights Reserved