Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Monday, 27 February 2017

Formula based program

Formula #2 (Perimeter and area of circle)

Enter radius: 5
Perimeter of circle: 31.4159265358979
Area of circle: 78.5398163397448

The program for the formula is written in C# programming language and will accept a number as radius. Based on the formula it will find out the perimeter and area of circle.
Formula based program

Note: If you are new to C# and Console Application. Try to code First C# Program

Note: Read articles on how to use Loops and Conditions.

Let’s find out a simple and easy way to code these formula.

Practical Implementation:

using System;

namespace patternProblem.Formula
    class Formula2     //area and perimeter of circle
        static void Main(string[] args)
            Console.Write("Enter radius: ");
            double radius = Convert.ToDouble(Console.ReadLine());
            double area = 0.0, perimeter=0.0;

            perimeter = 2* Math.PI * radius;
            area = Math.PI * (Math.Pow(radius, 2));

            Console.WriteLine("Perimeter of circle: {0}", perimeter);
            Console.WriteLine("Area of circle: {0}", area);


The input radius here is 7. So, based on the circle formula. The output is shown below:

Enter radius: 7
Perimeter of circle: 43.9822971502571
Area of circle: 153.9380400259
Press any key to continue . . .

For any query, comment us below.

Skip to Main Table – Formula based program

Previous – Formula based program #1

Click imagination hunt to read latest blogs.

Keep learning and sharing...

No comments:

Post a comment

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...