std 9 Chapter 6 Mathematical Library Methods - Programs
std 9 Chapter 6 Mathematical Library Methods - Programs
Question 1
Write a program in Java to input three numbers and display the greatest and the
smallest of the two numbers.
Hint: Use Math.min( ) and Math.max( )
Sample Input: 87, 65, 34
Sample Output: Greatest Number 87
Smallest number 34
import java.util.Scanner;
Output
Question 2
import java.util.Scanner;
Output
Question 3
Write a program to input a number and evaluate the results based on the number
entered by the user:
(a) Natural logarithm of the number
(b) Absolute value of the number
(c) Square root of the number
(d) Cube of the number
(e) Random numbers between 0 (zero) and 1 (one).
import java.util.Scanner;
Output
Question 4
In an examination, you have appeared for three subjects i.e. Physics, Chemistry and
Biology. Write a program in Java to calculate the average mark obtained and finally
display the marks in rounded-off form.
Take Physics, Chemistry. and Biology marks as inputs.
import java.util.Scanner;
Output
Question 5
import java.util.Scanner;
Output