Define a function called isEvenOdd(n) that accepts a number n as input argument and returns whether the number is even or odd. Call your functions

Answers

Answer 1

#include <bits/stdc++.h>

typedef std::string s;

s isEvenOdd(int n) {

   return (n%2==0) ? "Even" : "Odd";

}

int main(int argc, char* argv[]) {

   int x; std::cin>>x;

   std::cout << isEvenOdd(x) << std::endl;

   return 0;

}

Answer 2

Answer:

Explanation:

var n : integer;

 

 function IsEvenOdd (n : integer): boolean;

 begin

   if odd (n) then  Result := true

              else  Result := false;

 end;

 

 begin

   Write (' n = '); ReadLn (n);

   WriteLn ('  ', IsEvenOdd (n));

 end.  

 

 


Related Questions

What is output if the user types in 7? Click all that apply.

Answers

Based on the code that is given below, the output if the user types in 8 is option C:  C.

What is the line of code about?

The code above is an if statement: A will not be printed since the user had specified x = 8, which does not satisfy the criterion x!= 8 (!= stands for not equal).

Since x must be greater than or equal to 10 in order to satisfy the criterion for "B" to be printed, "B" will not be printed because x does not meet the condition.

Also x is less than 10, the requirement of x10 is satisfied, and "C" will be printed as a result.

Learn more about coding from

https://brainly.com/question/20312196

#SPJ1

See correct question below

x = int (input ("Enter a number: "))

if (x != 8):

print ("A")

if (x >= 10):

print ("B")

if (x < 10):

print ("C")

if (x % 2 == 1):

print ("D")

What is output if the user types in 8? Click all that apply.

A

B

C

D

4. Some programs add extra characters,
called a(n)________, to
a file name.

Answers

Answer:

big letters

Explanation:

in order for the file to be more impacable

Other Questions
by the end of august 2007, about 44% of the contiguous u.s. was categorized in a "moderate to extreme" drought based upon the palmer drought severity index. Singer A and Singer B had the two top-grossing concert tours for a certain year, together generating $438 million in ticket sales. If Singer B took in $22 million less than Singer A, how much did each tour generate? Senator Joseph McCarthy ruthlessly lead the groups investigations and thought that communists were infiltrating America through what 3 areas? The unit for volume in W/V% questions is litres when mass is in grams. True False Jordan Will hike the trail shown at a rate of 5mi/h. write a linear equation to represent the distance Jordan still has to walk after X hours. what does the Y-intercept of the equation represent? Triangle ABC with vertices A(-9,-7) B(-6,-2) C(-3,-6) is translated 5 units to the right and 3 units up then the image is reflected on the x-axis. What are the coordinates of the final image? What kind of food provides energy for much of the human population An intron is a segment of RNA found in pre-messengerRNA (pre-mRNA) molecules. It must be removed to makethe mRNA molecule functional. Some introns are capableof catalyzing the reaction that removes them from largerRNA molecules.What is the intron acting as in this scenario?OA. A lipidB. A membraneOC. An enzymeOD. A carbohydrate If we define the system as the water and the copper cube together, we can also say that there is no loss of heat to the surroundings due to the cups insulating properties. Considering this, what is the value of qsystem? enter your answer in terms of joules, but do not include the units in the blank. In the diagram line, AC is parallel to line DF which angle corresponds to HEF. CAN SOMEONE HELP MEEEEEEEEEEEEE Im really need help don't ask why 4 questions but I will give 15 to the most genius pls pls help me A student measured out 0.333 moles of theobromine, CyH3N402 (MM = 180.8/mol) theprimary alkaloid found in chocolate. How many molecules of theobromide did thestudent measure If the nyasasaurus parringtoni was found only in rock layer 2 and a fossil of an unknown plant was found only in rock layer 4, what would a paleontologist know about the comparative age and environment of the nyasasaurus parringtoni and the unknown plant? Please help I'll put you as brainliest!! The sum of the ages of Tameka, Jessica, and Venessa is 57. Tameka is 3 years older than Jessica and 6 years older than Venessa. How old is Tamika? Mr. Bowen used 2 gallons of paint on 1/3 of his fence. How many more gallons ofpaint does he need to finish paining the entire fence? Point D is the circumvented. AB= 42 DC= 29DF= 16FC =28AG= 33 What does Britain's exit from the European Union mean for the supranational organization? (minimum of 5 sentences) Write and solve a word problem that can be solved using decimals addition that requires regrouping the 10th in Africa in Eurasia, from 1450 to 1750 various forms of Islam and Christianity were key factors in the expansion of empires