input data with scanf, the output of the calculation results require a text description, take the decimal point after 2 digits. the circumference length, circle area, sphere surface area, sphere volume and cylinder volume are obtained.
Program:
#include <stdio.h>
int main ()
{
float H,r,c,s,sq,vq,vz;
float pi = 3.141526;
printf ("Please input circle radius r, Cylinder high H:");
scanf ("%f,%f", &r,&h);
c = 2 * PI*R;
s = pi*r*r;
Sq = 4 * PI*R*R;
VQ = (4/3) *pi*r*r*r;
VZ = pi*r*r*h;
printf ("Circumferential Length: c=%6.2f\n", c);
printf ("Circle area: s=%6.2f\n", s);
printf ("Spherical surface area: sq=%6.2f\n", sq);
printf ("Sphere Volume: vq=%6.2f\n", VQ);
printf ("Cylinder Volume: vz=%6.2f\n", VZ);
return 0;
}
Results:
Please input circle radius r, cylinder height h:1.5,3
Circumference Length: c= 9.42
Circle Area: s= 7.07
Spherical surface area: sq= 28.27
Sphere Volume: Vq= 10.60
Cylinder Volume: vz= 21.21
Please press any key to continue ...
This article is from the "Rock Owl" blog, please be sure to keep this source http://yaoyaolx.blog.51cto.com/10732111/1740264
C Language: To find the circumference of long, round area, sphere surface area, sphere volume, cylinder volume.