MATHEMATICAL LIBRARY METHODS
(UNSOLVED JAVA PROGRAMS)
________________________________________________________________
Q1
import [Link].*;
public class Q1{
public static void main(){
Scanner sc = new Scanner([Link]);
[Link]("Enter the first number");
int a = [Link]();
[Link]("Enter the second number");
int b = [Link]();
[Link]("Enter the third number");
int c = [Link]();
int min = [Link](a,b);
int fmin = [Link](min,c);
[Link]("The smallest number is "+fmin);
int max = [Link](a,b);
int fmax = [Link](max,c);
[Link]("The greatest number is "+fmax);
}
}
________________________________________________________________
Q2
import [Link].*;
public class Q2{
public static void main(){
Scanner in =new Scanner([Link]);
[Link]("Enter the perpendicular of the triangle");
double p = [Link]();
[Link]("Enter the base of the triangle");
double b = [Link]();
double h = [Link](p*p + b*b);
[Link]("The hypotenuse of the triangle "+h);
}
}
________________________________________________________________
Q3
import [Link].*;
public class Q3{
public static void main(){
Scanner in = new Scanner([Link]);
[Link]("Enter a number");
double a = [Link]();
double abs = [Link](a);
[Link]("The absolute value of the number "+abs);
double sq = [Link](a);
[Link]("The square root of the number "+sq);
double cu = [Link](a,3);
[Link]("The cube of the number "+cu);
double ran = [Link]();
[Link]("The random number between 0 and 1 " +ran);
}
}
________________________________________________________________
Q4
import [Link].*;
public class Q4{
public static void main(){
Scanner in = new Scanner([Link]);
[Link]("Enter Physics marks");
double p = [Link]();
[Link]("Enter Chemistry marks");
double c = [Link]();
[Link]("Enter Biology marks");
double b = [Link]();
double sum = p+c+b;
double avg = sum/3.0;
[Link]("The average of the marks is "+avg);
}
}
________________________________________________________________
Q5
import [Link].*;
public class Q5{
public static void main(){
Scanner in = new Scanner([Link]);
[Link]("Enter the area of the circle ");
double a = [Link]();
double r = [Link](7*a/22);
[Link](" The radius of the circle "+r);
}
}