// Programmer: Janet Joy // A function to find the area of a circle using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace circle { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnSubmit_Click(object sender, EventArgs e) { // Get the radius by parsing the value in text box. string s = txtRadius.Text; double radius = 0; Double.TryParse(s, out radius); // Display the area of the circle by calling the function. lblArea.Text = areaCircle(radius).ToString(); } private double areaCircle(double r) { // Calculate the area of a circel when passed the radius. return Math.PI * r * r; } } }