C语言习题 求sinh(x)

来源:互联网 发布:淘宝买飞机 编辑:程序博客网 时间:2024/06/07 22:46

Description

写一函数求sinh(x)的值,求sinh(x)的近似公式为 sinh(x) =(ex-e-x)/2 ,其中用一个函数求ex。结果保留两位小数。

Input

x

Output

sinh(x)的值。

Sample Input

1

Sample Output

1.18

HINT

 主函数已给定如下,提交时不需要包含下述主函数

int main(){
 double x;
 scanf("%lf",&x);
 printf("%.2f\n",udf_sinh(x));
 return 0;
}



  1. #include <stdio.h>
  2. #include<math.h>
  3. double e=2.71828183;
  4. double udf_sinh(double x);
  5. double udf_sinh(double x)
  6. {
  7.     return((pow(e,x)-pow(e,-x))/2);
  8. }
  9. int main(){
  10.  double x;
  11.  scanf("%lf",&x);
  12.  printf("%.2f\n",udf_sinh(x));
  13.  return 0;
  14. }
0 0
原创粉丝点击