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

1. What is the respiratory structure of a millipede? A. book lungs B. tracheal tube C. gill slits 2. what is the respiratory structure of a spider? A. gills B.
how do u divide 16 by 3/5
Over what period of time would you expect to see large changes in mountains,canyons,and similar features of the earth?
Over what period of time would you expect to see large changes in mountains,canyons,and similar features of the earth?
what are some reasons for limiting authority
Help??? What is 3x+5x=67y?
7x+3y=22 4y=20 I need to know how to write this equation out with the answer
how many books did Harriet beecher stowe write?
after clicking the start button on your computer screen desktop what option would you then select to examine system components you might want to modify?
do you know how to say my in Spanish?