scotrebe225 scotrebe225
  • 04-07-2019
  • Computers and Technology
contestada

Write a function which accepts an integer and returns true if the number is odd or false if the number is even

Respuesta :

SerenaBochenek SerenaBochenek
  • 12-07-2019

Answer:

#include<stdio.h>

#include<stdbool.h>

bool isEven(int x);

main()

{

int n;

bool v;

printf("Enter an integer: \n");

scanf("%d", &n);

v = isEven(n);

if(v==true)

 printf("\n The integer is even");

else

 printf("\n The integer is odd");

}

bool isEven(int x)

{

if(x%2==0)

 return true;

else

 return false;

}

Explanation:

if the integer is divided by 2 then the integer is even

else the integer is odd.

Ver imagen SerenaBochenek
Answer Link

Otras preguntas

under what condition does a business make a profit?
Which of the following should a woman NOT wear to work? shoes with heels skirts that fall at the knee tops with spaghetti straps pants of any kind
What can you conclude about the policy areas in the state of Georgia ?
plz help me ASAP. I don't understand this.​
If a bacterium could divide into two every 20 how many bacteria would be produced after eight hours?
Describe an action that you could take to improve the health of your school. make a prediction about the effect that action has on your community? justify you
Evaluate x2/y + x2/z for x = 6, y = -4, and z = -2.
What is the solution to this open sentance? 4x-4=2x+2
who is the winner in unaticipated increase in real interest rates?
How did the Roman Empire react to citizens not wanting to join its army due to a decline in patriotism? A)they hired non-Romans German people or mercenaries B)t