Vidyalelo
C# Programming · Q28

Functions and Methods in C Sharp

Programming · C# Programming · question 28

Q28

What is the correct syntax to define a method named CalculateArea that calculates the area of a rectangle with length and width parameters in C#?

A.
double CalculateArea(double length, double width) { return length * width; }
B.
CalculateArea(double length, double width) { return length * width; }
Answer
C.
double CalculateArea(length, width) { return length * width; }
D.
CalculateArea { double length * double width; }

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board