C Language: To find the circumference of long, round area, sphere surface area, sphere volume, cylinder volume.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.