Answer to Question #248102 in C# for scott

Question #248102

Choose your desired operation

[CIRCUMFERANCE OF A CIRCLE]

[PERIMITER OF A TRIANGLE]


1
Expert's answer
2021-10-07T13:59:49-0400
using System;


namespace App
{
    class Program
    {
        static void Main(string[] args)
        {


            int operation = -1;
            while (operation != 3)
            {
                Console.WriteLine("1. CIRCUMFERANCE OF A CIRCLE");
                Console.WriteLine("2. PERIMITER OF A TRIANGLE");
                Console.WriteLine("3. EXIT");
                Console.Write("Choose your operation: ");
                operation = int.Parse(Console.ReadLine());
                if (operation == 1)
                {
                    Console.WriteLine("Enter a radius of a circle: ");
                    double radius = double.Parse(Console.ReadLine());
                    double circumferenceCircle = 2 * Math.PI * radius;
                    Console.WriteLine("Circumference of a circle : {0}", circumferenceCircle);
                }
                else if (operation == 2)
                {
                    Console.WriteLine("Enter a side 1 of a triangle: ");
                    double side1 = double.Parse(Console.ReadLine());
                    Console.WriteLine("Enter a side 2 of a triangle: ");
                    double side2 = double.Parse(Console.ReadLine());
                    Console.WriteLine("Enter a side 3 of a triangle: ");
                    double side3 = double.Parse(Console.ReadLine());
                    double perimiter = side1 + side2 + side3;
                    Console.WriteLine("Perimiter of a triangle : {0}", perimiter);
                }
            }


        }
    }
}

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