Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

# C# Calculating the area of a circle w/radius from user

### #1 wundermutt

wundermutt

• Members
• 3 posts
• OFFLINE
•
• Local time:12:40 PM

Posted 03 July 2010 - 06:22 PM

Assingment: Write an application that prompts the user for the radius of a circle and use method CircleArea to calculate the area of the circle. Turn in your source code on uLearn

My Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class Circle // declaration of class - I want to find area of circle

{
static void Main(string[] args)
{
double r;

double CircleArea;

double pi = 3.14;

Console.WriteLine("Would you like to know the area of a circle?");//intro message

r = Convert.ToDouble(Console.ReadLine()); //assings number from end-user to variable r

CircleArea = (3.14 * r * r); //this is the equation for the area of a circle

Console.WriteLine("The area of the circle is" + CircleArea);

}
}
}

### #2 groovicus

groovicus

• Security Colleague
• 9,963 posts
• OFFLINE
•
• Gender:Male
• Location:Centerville, SD
• Local time:10:40 AM

Posted 04 July 2010 - 12:06 AM

Did you have a question?

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users