-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram31_Math.java
More file actions
26 lines (20 loc) · 853 Bytes
/
Program31_Math.java
File metadata and controls
26 lines (20 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Write a java program that uses any 5 methods of "Math" class.
// Date : 31/03/2024, Author : Yash Wadhvani
import java.util.Scanner;
public class Program31_Math {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a, b;
System.out.println("Enter 1st Number :-");
a = sc.nextInt();
System.out.println("Enter 2nd Number :-");
b = sc.nextInt();
sc.close();
System.out.println("(a,b) = (" + a + "," + b + ")");
System.out.println("Maximum of (a,b) = " + Math.max(a, b));
System.out.println("Square Root of a = " + Math.sqrt(a));
System.out.println("Sine of a =" + Math.sin(a));
System.out.println("Cos of b = " + Math.cos(b));
System.out.println(a + " raised to power " + b + " = " + Math.pow(a, b));
}
}