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 difference between ancient times and modern times
please help Q 4 the order pairs
How do you write in words 0.102
Jessica bakes 112 muffins in 7 batch. How many muffins does each batch contain?
The ice at a certain hockey rink is made by freezing water that is 1.5 inch deep. how many gallons of water does it take? approximate the rink as a 200 ft by 85
In Europe, gasoline efficiency is measured in km/L. If your car's gas mileage is 25.0 mi/gal , how many liters of gasoline would you need to buy to complete a 1
Did I get it right it’s number 7
in the journey franchise what comes before journey 2 the mysterious island and what comes after
Soon after taking a psychoactive drug, zachary experienced a diminished appetite, an increased heart rate, dilated pupils, and feelings of self-confidence and e
The Five Civilized Tribes ______________ a. consisted of the Cheyenne, Ute, Comanche, Navajo, and Apache. b. owned 100 million acres and many practiced settled