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 algebra
is insulating ability a chemical property or physical?
Is the number of calories you have burned since midnight at any time during the say a function\?
-x - 1 = 221 + 2x plzzzzzzzzz help
A species of rose (plants) lacks thorns. how would biologists explain how a species of rose lacking thorns evolved from an ancestral rose species with thorns?
From papyrus, the _______ made a type of paper. assyrians babylonians egyptians sumerians
How did the dutch and the iroquois differ in their views of the trading relationship? What factors contributed to these differences?
Draw one card at random from a standard deck of cards. the sample space s is the collection of the 52 cards. assume that the probability set function assigns 1/
Please solve this ^ problem
Why were the straits between the aegean and the black seas so important to the byzantines?