Jump to content


Register a free account to unlock additional features at BleepingComputer.com
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.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


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

  • Please log in to reply
1 reply to this topic

#1 wundermutt


  • Members
  • 3 posts
  • 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;

namespace Radius{

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

Console.WriteLine("Please enter the radius."); //promt end-user for number

Console.ReadLine();//reads input from end-user

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);


BC AdBot (Login to Remove)


#2 groovicus


  • Security Colleague
  • 9,963 posts
  • 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