Flamer


私信TA

用户名:ding876255970

访问量:46840

签 名:

不怕别人比你优秀,就怕别人比你努力!

等  级
排  名 124
经  验 7521
参赛次数 0
文章发表 49
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

解题思路:

      愉快的心情才能使自己身心投入!    

每题笑话:


      我:你刚刚撤回什么了? 女友:没什么。 我:别以为我没看到,你发的是“你走吧”,肯定发完又后悔了是不是? 女友:并不是。 我:别不承认了,你舍不得我了。 女友:你想多了,我只是觉得程度不够,你滚吧!!


注意事项:


    学精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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区

#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;
}为什么从大到小就是错的
2022-02-27 00:13:00
老哥要是能纠正下格式再好不过了。哈哈
2020-03-09 11:05:57
#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;
}

这才是少代码
2019-12-03 19:16:40
3带进去对吗   你们试试
2019-05-14 01:21:37
为什么不把printf 放在主函数,免去打那么多printf;
2018-03-09 21:53:58
2018-01-17 10:29:28
  • «
  • 1
  • »