Thursday, February 27, 2014

Cylinder Volume w/ Double: (Wk-2), Jan 14, 14

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Volume_w_Double
{
    class Program
    {
        static void Main(string[] args)
        {
            double radius, height, perimeter, area, volume;

            Console.Write("Enter radius of cylinder: ");
            radius = Convert.ToDouble(Console.ReadLine());

            Console.Write("Enter height of cylinder: ");
            height = Convert.ToDouble(Console.ReadLine());

            perimeter = 2 * Math.PI * radius;
            area = Math.PI * radius * radius;
            volume = Math.PI * radius * radius * height;
         
            Console.WriteLine("Perimeter: {0} \nArea: {1} \nVolume: {2}", perimeter, area, volume);
            Console.ReadLine();
        }
    }
}


No comments:

Post a Comment