我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!
天气: 晴朗
心情: 高兴
/*fileName:P5Q17.java
*Name:Wang Chaoran
* Description:
17 (Using trigonometric methods)
Print the following table to display the sin value and cos value of
degrees from 0 to 360 with increments of 10 degrees. Round the value to keep four digits after the decimal point.
Degree Sin Cos
0 0.0 1.0
10 0.1736 0.9848
...
350 -0.1736 0.9848
360 0.0 1.0
*/
public class P5Q17{
public static void main(String[] args){
System.out.println("Degree Sin Cos");
for(int i=0;i<=360;i+=10){
System.out.print(i+" ");
if(i<100)
System.out.print(" ");
if(i<10)
System.out.print(" ");
System.out.printf("%-6.4f",Math.sin(Math.toRadians(i)));
if(Math.sin(i)>=0)
System.out.print(" ");
System.out.print(" ");
System.out.printf("%-6.4f",Math.cos(Math.toRadians(i)));
System.out.println();
}
}
}
导入论坛查看(42)回复(0)引用(0)好评(0) 差评(0)
加入收藏
编辑
审核
TAG:
computing