解题思路:
愉快的心情才能使自己身心投入!
每题笑话:
我:你刚刚撤回什么了? 女友:没什么。 我:别以为我没看到,你发的是“你走吧”,肯定发完又后悔了是不是? 女友:并不是。 我:别不承认了,你舍不得我了。 女友:你想多了,我只是觉得程度不够,你滚吧!!
注意事项:
学精C语言,必须在做题时尽量用比别人少的代码完成任务!
参考代码:
#include<stdio.h> #include<math.h> int main() { float x; scanf("%f",&x); if(x<0) { printf("%.2f\n",-x); } else if(x<2) { printf("%.2f\n",pow(x+1,0.5)); } else if(x<4) { printf("%.2f\n",pow(x+2,5)); } else { printf("%.2f\n",2*x+5); } return 0; }
有不懂得可以留言!看在小的这么用心的份上,看客老爷们点个赞吧!
0.0分
10 人评分
#include <stdio.h> #include <math.h> int main() { double x,y; scanf("%lf",&x); if(x>=4) y=2*x+5; if(x>=2) y=pow(x+2,5); if(x>=0) y=sqrt(x+1); if(x<0) y=fabs(x); printf("%.2f",y); return 0; }为什么从大到小就是错的
#include<stdio.h> #include<math.h> int main(){ float x; scanf("%f",&x); printf("%.2f\n",x<0?-x:(x<2?pow(x+1,0.5):(x<4?pow(x+2,5):2*x+5))); return 0; } 这才是少代码
为什么不把printf 放在主函数,免去打那么多printf;
不容易系列2 (C语言代码)浏览:636 |
简单的a+b (C语言代码)浏览:596 |
printf基础练习2 (C语言代码)浏览:688 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:701 |
演讲大赛评分 (C语言代码)浏览:1692 |
字符逆序 (C语言代码)浏览:673 |
良心推荐——>题解1049:C语言程序设计教程(第三版)课后习题11.1 (C语言描述——简单明了,时间复杂度低)浏览:1313 |
分解质因数 (C++代码)浏览:1554 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:588 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:487 |