Eric Kraus

Eric Kraus

  • NA
  • 9
  • 513

Area of a circle, with default integer value

Mar 9 2020 1:20 PM
  1. static void Main(string[] args)  
  2.     WriteLine("What is the radius of your circle: ");  
  3.     WriteLine("The area of your circle is: " + circleArea(Double.Parse(ReadLine())).ToString());
  4.     ReadKey();  
  5. }  
  6. static double circleArea(double radius = 5.00)      
  7. {              
  8.     return Math.PI * (radius * radius);  
  9. }  
So far the code I have is working and it is able to calculate the area of a circle; however, I need to have the main method pass an integer variable (radius) with an optional default value. I thought I had it by adding =5 to my second method, but that wasn't it. 
Any help would be appreciated.  

Answers (3)