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

what is the relationship between the 6s in the number 660,472
What is the base word of the word relationship
Which was the most major cause of foreign interest in Persia? a. Persia had weak export laws. b. Persia reversed its strong immigration policy. c. Persia mai
you spend $46 on supplies to make wooden ornaments and plan to sell the ornaments for $8.50 each what is the number of ornaments that you must sell in order to
10 times as many as 1 hundred is how many hundreds
In what way did ancient Athens influence the framers of the United States Constitution?
Which best describes the way historians consider letters and journals?
3-2(m+4)=15 how do I do this
numbers expressed using exponents are called (blank)
Segment AB is congruent to segment AB. This statement shows the property. a. reflexive b. symmetric c. transitive d. substitution