English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

請問......cos (180)要怎麼用java的程式來算....程式該如何寫???

2007-12-01 12:27:28 · 1 個解答 · 發問者 Anonymous in 電腦與網際網路 程式設計

1 個解答

//Power by Eclipse
//Download Site: http://www.eclipse.org/
import java.io.*;
import java.util.*;
public class TEST
//檔名:TEST.java
{
public static void main(String[] args)
{
PrintStream o=new PrintStream(System.out);
Scanner in=new Scanner(System.in);
o.printf("Input degree: ");
double deg=in.nextDouble();
double radian=Math.PI*deg/180;
o.printf("sin(%f)= %f\n",deg,Math.sin(radian));
o.printf("cos(%f)= %f\n",deg,Math.cos(radian));
o.printf("tan(%f)= %f\n",deg,Math.tan(radian));
}
}

2007-12-01 13:36:51 · answer #1 · answered by Big_John-tw 7 · 0 0

fedest.com, questions and answers