-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrigonometryTable.java
More file actions
34 lines (33 loc) · 968 Bytes
/
TrigonometryTable.java
File metadata and controls
34 lines (33 loc) · 968 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
27
28
29
30
31
32
33
34
package example;
public class TrigonometryTable {
public static void main(String args[]){
System.out.print(" ");
for(int i = 0 ; i <= 120 ; i += 15)
System.out.printf("%8d",i);
System.out.print("\n");
System.out.print("\nSin : ");
getSineValue();
System.out.print("\nCos : ");
getCosValue();
System.out.print("\nTan : ");
getTanValue();
}
public static void getSineValue(){
for(int i = 0 ; i <= 120 ; i += 15)
System.out.printf("%8.3f",Math.sin(Math.toRadians(i)));
System.out.print("\n");
}
public static void getCosValue(){
for(int i = 0 ; i <= 120 ; i += 15)
System.out.printf("%8.3f",Math.cos(Math.toRadians(i)));
System.out.print("\n");
}
public static void getTanValue(){
for(int i = 0 ; i <= 120 ; i += 15){
if(i == 90)
System.out.printf("%8.1f",((int)Math.tan(Math.toRadians(i))*100)/100.0);
else System.out.printf("%8.3f",Math.tan(Math.toRadians(i)));
}
System.out.print("\n");
}
}