Question

Write a function prototype for a function that will accept a single integer. Create a function...

Write a function prototype for a function that will accept a single integer. Create a function that accepts an integer and determines if the integer is odd or even. create a smsll program that asks a user for an integer and calls a function that determines if the integer is even or odd. This is a C language program.
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

int evenOdd(int n){
    return n%2==0;
}

int main(){
   int n;
   printf("Enter number: ");
   scanf("%d",&n);
   if(evenOdd(n)){
      printf("%d is even\n",n);
   }
   else{
      printf("%d is odd\n",n);
   }
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
Write a function prototype for a function that will accept a single integer. Create a function...
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