Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write in C: 1.) Write the definition of a function isPositive, which rece

ID: 3756375 • Letter: P

Question

Please write in C:

1.) Write the definition of a function isPositive, which receives an integer parameter and returns true if the parameter is positive, and false otherwise.

So if the parameter's value is 7 or 803 or 141 the function returns true. But if the parameter's value is -22 or -57, or 0, the function returns false.

2.) Write the definition of a function isSenior, which receives an integer parameter and returns true if the parameter's value is greater or equal to 65, and false otherwise.

So if the parameter's value is 7 or 64 or 12 the function returns false. But if the parameter's value is 69 or 83 or 65 the function returns true.

Explanation / Answer

Assuming _Bool is to be used.

#include<stdbool.h>
_Bool isPositive(int x) {
if(x>0) return true;
else return false;
}
_Bool isSenior(int x) {
if(x>=65) return true;
else return false;
}

If you want to use return type as int. Simply replace _Bool by int, true by 1 and false by 0.