Question

This is for Program in C Write a program that asks the user for an integer...

This is for Program in C

Write a program that asks the user for an integer with the prompt "Please enter an integer" using the puts function.

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.

Call the function isSenior, and the following statement if the function returns true "The person is a senior". If the function returns false, print the following statement "The person is not a senior"

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

#include <stdio.h>

#include <stdlib.h>

int isSenior(int n){

return n>=65;

}

// Driver program

int main(void)

{

int n;

puts("Please enter an integer");

scanf("%d",&n);

if(isSenior(n))

puts("The person is a senior");

else

puts("The person is not a senior");

}

Add a comment
Know the answer?
Add Answer to:
This is for Program in C Write a program that asks the user for an integer...
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