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

Help please! 8th grade math! ASAP
how many ounces of pure oil should be mixed with an oil-gas solution that is 4.51% oil, to get 100 ounces of an oil-gas mixture that is 15% oil​
HELP ASAP PLEASE!! TEN POINTS
The US instituted rationing during?
Does the specimen have a jawless, funnel-like mouth?​
Why are countries drawn to modern economic systems?
How does the kinetic energy of a substance's particles in the solid phase compare to their kinetic energy in the liquid phase? (2 points) The kinetic energy of
Based on a sample survey, a company claims that 75% of their costumers are satisfied with their products. Out of 1,176 customers, how many would you predict to
what are the coordinates of a point on the directed line segment from (5,9) to (8,-6) that partitions the segment into a ratio of 3 to 2
in which sentence is the underlined phase an adjective preplsitional phase ​