21天养成良好习惯-17
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,m;
printf(“Please enter the number:\n”);
scanf("%d",&n);
if(n>0&&n<9)
printf("%d: 0-9",n);
else if(n>=10&&n<=99)
printf("%d: 10-99",n);
else if(n>=100&&n<=999)
printf("%d: 100-999",n);
else if(n>=1000&&n<=9999)
printf("%d: 1000-9999",n);
else
printf(“error!”);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float a,b,c,p,q,m;
printf(“Please enter the coefficients a,b,c:\n”);
scanf("%f,%f,%f",&a,&b,&c);
p=-b/(2a),q=sqrt(bb-4ac)/(2a);
m=bb-4ac;
if(m>0)
printf(“x1=%7.4f, x2=%7.4f\n”,p+q,p-q);
if(m<=0)
printf(“error!”);
return 0;
}