Answer to Question #256004 in C# for Umar farouk

Question #256004
2. (Compute the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas: area = radius * radius pie volume = area * length
1
Expert's answer
2021-10-24T18:32:21-0400
using System;
public class CylinderVolume {
  public static void Main() {
    Console.WriteLine("Input radius:");
    double radius = double.Parse(Console.ReadLine());
    Console.WriteLine("Input length:");
    double length = double.Parse(Console.ReadLine());
    
    double area = radius * radius * Math.PI;
    double volume = area * length;
    
    Console.WriteLine("Area is "+area.ToString());
    Console.WriteLine("Volume is "+volume.ToString());
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS