Question

C language please Write the definition of a function isSenior, which receives an integer parameter and...

C language please

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Function:

int isSenior(int n)
{
if(n >= 65) //if parameter is greater or equal to 65 return true.
return true;
else //if parameter is less than 65 return false.
return false;
}

int isSenior (int n) { if(n >= 65) //if parameter is greater or equal to 65 return true. return true; else //if parameter is

Program:

#include <stdio.h>
#include<stdbool.h> //function definition.
int isSenior(int n)
{
if(n >= 65) //if parameter is greater or equal to 65 return true.
return true;
else //if parameter is less than 65 return false.
return false;
}
int main()
{
int n=7; //declaring parameter value
if(isSenior(n)) //if function return true then print below message.
printf("%d is senior\n", n);
else //if function return false then print below message.
printf("%d is not senior\n", n);
return 0;
}

1 #include <stdio.h> #include<stdbool.h> //function definition. int isSenior (int n) 2 3 4 5 6 7 if(n >= 65) //if parameter i

output:

69 is senior Process returned © (@xo) execution time : 0.000 s Press any key to continue.

7 is not senior execution time : 0.011 s Process returned © (@xo) Press any key to continue.

Note: my friend if you have any questions or queries comment below. I am happy to answer your questions. I will sort out your queries. Thank you my friend,

Add a comment
Know the answer?
Add Answer to:
C language please Write the definition of a function isSenior, which receives an integer parameter and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT