rintf("能整除5");?else?printf("不能整除5");?return0;}3.1.2输入x,计算并输入下列分段函数对应的值。-5x<0Y=x2+20<=x<=1x/2x>1#include<stdio.h>intmain(void){?floatx,y;?printf("x=");?scanf("%f",&x);?if(x<0)?y=-5;?elseif(x>1)y=x/2;?else?y=x*x+2;printf("对应值为%.2f\n",y);return0;}3.1.3某商场给顾客购物的折扣率如下:购物金额<300元不打折300<=购物金额<500元9折500元<=购物金额7折要求输入一个购物金额(x),输出打折率(rate)以及购物实际付款金额(x*rate)#include<stdio.h>intmain(void){?intx,y;?printf("x=");?scanf("%d",&x);?if(x<300){ y=x;?printf("不打折,付款%d\n",y);?}?elseif(x>=300&&x<500)?{ y=0.9*x;?printf("打9折,付款%d\n",y);?}?else?{ y=0.7*x;?printf("打7折,付款%d\n",y);?}?return0;}3.1.4求解一元二次方程ax2+bx+c=0的实数解。#include<stdio.h>#include<math.h>intmain(void){?inta,b,c,d,x1,x2;?printf("a=,b=,c=");?scanf("%d,%d,%d",&a,&b,&c);?d=b*b-4*a*c;?if(d>0)?{?doublesqrt(doubled);?x1=(-b+sqrt(d))/(2*a);?x2=(-b-sqrt(d))/(2*a);