作业一:
作业1.1:C语言标准库的目的是什么?编写一个小程序,说明如何使用标准库里的数学函数;
我编写的程序:
#include<stdio.h>
#include<math.h>
void main()
{
float a,b;
printf("请输入角度度数\n",b);
scanf("%f",&b);
a=sin(b);
printf("%f\n",a);
}
作业1.2:用一个程序计算下面两个表达式的值;
我编写的程序:
#include<stdio.h>
float chujia(float a,float b,float c)
{
float s;
s=a/(b+c);
return s;
}
void main()
{
float a,b,c;
float s;
a=234;
b=1;
c=257;
s=chujia(a,b,c);
printf("234/(1+257)=%f\n",s);
a=1065;
b=24;
c=13;
s=chujia(a,b,c);
printf("1065/(24+13)=%f\n",s);
}
运行的结果:
作业1.3:利用C标准库里的数学函数<math.h>,用一个程序计算下面两个表达式的值;
.
我编写的程序:
#include<stdio.h>
#include<math.h>