← Back
Code Challenge 4.1 - Circle Area Calculator Function
Objective
Your task is to write a program that calculates the area of a circle given its radius. This time, we’ll focus on encapsulating the code into functions/methods.
Skills to Practice:
- Defining functions/methods.
- Passing arguments to functions.
- Returning values from functions.
- Utilizing mathematical operations.
Challenge Tasks
- Create a console project named Challenge 4-1.
- Define a function/method to calculate the area of a circle.
- Example signatures:
Python
def calculate_area(radius):
# code
C#
double CalculateArea(double radius)
{
// code
}