20 lines
268 B
C++
20 lines
268 B
C++
#include "isEven.h"
|
|
|
|
bool isEven(int x) {
|
|
switch (x) {
|
|
case 0:
|
|
return true;
|
|
case 1:
|
|
return false;
|
|
case 2:
|
|
return true;
|
|
case 3:
|
|
return false;
|
|
|
|
// Why defininfg more cases when the compiler can do it ?
|
|
|
|
default:
|
|
return isEven(x);
|
|
}
|
|
}
|