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 it is not broken, then do not fix it. Identify the converse of the conditional statement.
singular form of unos cuadernos:
Senator O'Reilly says that we should not support the initiative to funnel more money into public schools. I completely disagree, and I don't understand why Sena
Put parentheses around the adverb clause in this sentence "i will call as soon as he comes in"
How can a person guard against a decrease in heart and lung function?
Emily: ¿Cuántos días en la semana ordenas tu cuarto? Luisa: _______________________________ Question 7 options: Cada lunes tengo que limpiar la cocina. Todos
functions of the jse in details
The purpose of a lyric is to tell a story true or false
A city official has suggested raising permit fees for events like public rallies. The proposal has sparked a debate in the community. You have decided to submit
When solving negative one over five (x − 25) = 7, what is the correct sequence of operations?