Vidyalelo
C# Programming · Q15

Functions and Methods in C Sharp

Programming · C# Programming · question 15

Q15

What is the correct way to define a method named GetSquare that takes an integer parameter num and returns its square in C#?

A.
GetSquare(num)
B.
int GetSquare = (int num) { return num * num; }
C.
int GetSquare(int num)
Answer
D.
int GetSquare(num) { return num * num; }

Answer: Option C

Solution

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