输出逆序数
int main()
{
int x , b0, b1 , b2 , y;
scanf("%d",&x);
x = (int)fabs(x);
b2 = x / 100;
b1 = (x-b2*100)/10;
b0 = x % 10;
printf("%d\n%d\n%d\n",b2,b1,b0);
y = b0*100 + b1*10 +b2;
printf("%d\n",y);
return 0;
}
计算年利率
#include <math.h>
main(){
float a, b, c, disc, p, q;
scanf("%f%f%f",&a,&b,&c);
disc = b*b - 4*a*c;
p = -b / (2*a);
q = sqrt(disc)/(2*a);
printf("%7.4f,%7.4f\n",p+q,p-q);
}
计算球的体积和表面积
#include <math.h>
const double pi = 3.14159;
main(){
double r, surface,volume;
scanf("%lf",&r);
surface = 4 * pi * pow(r,2);
volume = 4.0/3.0 * pi * pow(r,3);
printf("%lf\n%l