Created
September 7, 2020 04:43
-
-
Save mdradityatama/5010e6dd74108a7e395c7fd415df92b6 to your computer and use it in GitHub Desktop.
calculate circle foruma for area with input value, c#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ConsoleApp.BasicCSharp | |
{ | |
class ExecuteProgram | |
{ | |
static void Main(string[] args) | |
{ | |
Circle circle = new Circle(); | |
circle.PrintResult(); | |
} | |
} | |
class Circle | |
{ | |
double radius; | |
double pi = Math.PI; | |
public void Input() | |
{ | |
Console.Write("Input Value r = "); | |
radius = double.Parse(Console.ReadLine()); | |
Console.WriteLine($"Value pi = {pi}"); | |
} | |
public double Calculate() | |
{ | |
Console.WriteLine("\nFormula : pi * r * r"); | |
return pi * radius * radius; | |
} | |
public void PrintResult() | |
{ | |
Console.WriteLine("==============================="); | |
Console.WriteLine(" Circle Formula for Area"); | |
Console.WriteLine("==============================="); | |
Input(); | |
var result = Calculate(); | |
Console.WriteLine($"\nResult : {result}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment