Examveda

What is the correct way to define a method named IsEven that takes an integer parameter num and returns true if the number is even, otherwise false, in C#?

A. IsEven(num) { return num % 2 == 0; }

B. bool IsEven = (int num) => num % 2 == 0;

C. bool IsEven(int num) { return num % 2 == 0; }

D. bool IsEven { return num % 2 == 0; }

Answer: Option C


Join The Discussion

Related Questions on Functions and Methods in C Sharp