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

If Fernando paid $450 for a notebook that was 75% of the original price, what was the original price?
Article One of the Constitution illustrates how the national government's power is (4 points) Select one: a. derived from the states and the people b. granted t
Veronica is saving money to by a saddle for her horse that costs 175 . She plans to save $10 the first month and then increased amount she say's by five each mo
Which planet has very large dust storms
explain why 2.15 and-2.15 opposite
What is the solution to the equation? 32 - 6x + 7x = -15 + 28 X =??
Plz help with these questions!!
4|x+5|=20 Thanks for the help
What type of charge does an neutron
Is colony a collective noun