kwrl.net
当前位置:首页 >> 用C语言. 请编写一个程序,功能是:计算并输出下列... >>

用C语言. 请编写一个程序,功能是:计算并输出下列...

#include int main() {int n=2,i; float sum=0; for(i=1;i

#include double fun(int n) { int i; double s=0; for(i=1;i

#includeint main(){int x,y;printf("输入x的值:"); scanf("%d",&x);if(x1&&x=10)y=3*x-11;printf("y=%d\n",y);return 0;}

#include#includeint main(){ double x, y; scanf ("%lf", &x); if (x > 0)y = sqrt(2*x); else if (x < 0)y = 1.0/(3*exp(x)); else y = 0; printf ("%.2f\n", y); return 0;}

#include "stdio.h" int main(void) { int x; scanf("%d", &x); if (x > 100) printf("%d", x + 10); else if (x < -10) printf("%d", -x + 10); else printf("0"); return 0; }

#include int main(void) { int n; int i, j; float sum = 1.0; float dex = 1.0; printf("输入一个数:"); scanf("%d", &n); for (i = 2; i 0; --j) { dex*=j; } sum+=1/dex; dex = 1.0; } printf("%.2f\n", sum); return 0; }

编程实现计算n!,也就是n*(n-1)*(n-2)*....*1,可以通过递归函数来实现,具体实现方法: #include int Func(int n){if(n < 2) return 1; else return n*Func(n-1); } void main(){int n =0,m=0; printf("请输入一个正整数:") scanf("%d",&...

#include void main() { double sum,t,f,n; int k; sum=0; f=1; k=1; scanf("%lf",&n); do { t=f/(k*(k+1)+n); s+=t; k++; f*=(-1); } while ( fabs(t)>=0.0001 ); printf("k=%d,sum=%lf\n",k,sum); }

#include void main() { float c,f; printf("\n请输入华氏温度(F):"); scanf("%f",&f); c=(f-32)*5/9; printf("\n华氏温度 %1.2f 对应的摄氏温度为: %1.2f\n",f,c); } 扩展资料: 编程的执行原理 计算机对除机器语言以外的源程序不能直接识别、...

#include #include #include int countvalue(int *cnt){ int a, b, c; *cnt=0; for(a=1;a

网站首页 | 网站地图
All rights reserved Powered by www.kwrl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com