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

Why is Britney Spears insane? I’m graduated so my points are up for grabs cause I’ll never use them. I have to at least as a question with it though.
How are you feeling today
It costs $2.50 to rent bowling shoes. Each game costs $2.25. You have $9.25. Write and solve an equation to find out how many games you can bowl.
f+1<5 please tyyyyyyyyyyyyyyyy
m r co m p re ssmy prev acc got banned and this is my new acc...im a boy of 19
Which decimal below is equivalent to 5/9?
- Briefly describe how you would prepare a simple acid base indicator.
What measurement could be the length of a pool?
How are you feeling today
hi folllow me at talfishmanfanpage09