Surface area and volume of cylinders

Source: Internet
Author: User
Tags define function

Copyright (c) Level 2014 Software 1 class//All rithts reseved.//A36 Huanghade//Completion Date: December 9, 2014////problem Description: Create a program to find the cylinder surface area and volume//output: Surface area and volume//u Sing system;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks; Namespace consoleapplication4{class Program {static void Main (string[] args) {Cylinder c Oumn1 = new Cylinder ();//Create Object coumn1.height = 3.5;//Reference class member Coumn1. R = 3;//refers to the class member Console.WriteLine ("Volume: {0}", Coumn1.            Bulk ()); Console.WriteLine ("Surface area: {0}", Coumn1.            superficial ());        Console.readkey ();  }} class Cylinder {Public double r;//defines the radius of the circle of the function R as a cylinder public double height;//defines the high public double superficial ()///Of the height cylinder ()///define function superficial {do uble lateral,s;//definition variable lateral: Side area, S: Round bottom area double x=3.1415;//define variable x: pi lateral = (R + Hei                ght) * 2;   S = x * Math.pow (R, 2);               return lateral + S * 2;                                      } public double Bulk () {Double x = 3.1415;//definition variable s: Round bottom area, x: Pi               return x * MATH.POW (R, 2) *height; }           }}

Surface area and volume of cylinders

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.