Answer to Question #296862 in C# for chi

Question #296862

Topic: Function


Write a function-­‐oriented program to calculate the area of a circle. Use the

formula: A=πr2 where Pi(π) is equal to 3.1416 (approximately).

note: you can choose any looping statement.


1
Expert's answer
2022-02-12T08:06:49-0500


using System;
using System.Collections.Generic;
using System.Globalization;


namespace App
{
    class Program
    {
        static double calculateAreaCircle(double radius)
        {
            const double PI = 3.1416;
            return PI * radius * radius;
        }
        static void Main(string[] args)
        {
            Console.Write("Enter the radius of the circle: ");
            double radius = double.Parse(Console.ReadLine());
            Console.WriteLine("The area of a circle: {0}", calculateAreaCircle(radius));




            Console.ReadLine();
        }
    }
}

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
New on Blog
APPROVED BY CLIENTS