[Functions]D. Liang 5.21 Using the trigonometric functions.c

Description

Print the sin value and cos value of degrees from 0 to 360 with increaments of 10 degrees.

Example Input

None

Example Output

      Degree         Sin         Cos
           0      0.0000      1.0000
          10     -0.5440     -0.8391
          20      0.9129      0.4081
         ...
         350     -0.9589     -0.2836
         360      0.9589     -0.2837

*The last line is a newline character.
You should set the width of print field of each column to 12, set the precision of floating-point numbers to 4 and fixed, justify the output to the right.

Note:

1. Output format required by the title;
2. Add 10 units to degree in turn, not one unit.

//   Date:2020/4/3 
//   Author:xiezhg5
#include <stdio.h>
#include <math.h>    //库文件中有计算三角函数的公式 
int main(void)
{
    printf("      Degree         Sin         Cos\n");
    int i;
    for(i=0;i<=360;i=i+10)
    {
    	printf("%12d%12.4lf%12.4lf\n",i,sin(i),cos(i));
    }
    return 0; 
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值