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

Express the fractions 2/3, 3//4 and 5/6 as equivalent fractions with a denominator of12​
What does the cellular respiration in the mitochondrion require?
What masses of sodium chloride, magnesium chloride, sodium sulfate, calcium chloride, potassium chloride, and sodium bicarbonate are needed to produce 1 L of ar
whats this i dont know if i subtract or add.
12. What are the 4 structures that are found in ALL cells?​
Which statement best supports the RNA world hypothesis? DNA molecules are a precursor to self-replicating RNA molecules, which are used to build proteins. Ear
Two hundred five thousandths in decimal form
POWERS OF 10 PRACTICE 7TH GRADE
Given the function F(x)=3x+2 f(x)=8 find the following f(x)=8
What type is a type of Gene where both allies can be expressed which statement best explains a person with AB blood type