- Define a function named
square, that when passed a floating-point value, returns its square. - Define a function named
isOdd, that when passed an integer value, returnstrueif it's odd,falseotherwise. - Define a function named
countTrueV1, that when passed two boolean values, returns the number of values that aretrue. - Define a function named
countTrueV2, that when passed three boolean values, returns the number of values that aretrue. - Define a function named
lowest, that when passed two values of typeint, returns the minimum of the three numbers. Do not use the built-inminfunction!
Assuming the following definition of a function bar:
float bar(float a, float b) {
return a * b + a;
}What does the expression bar(bar(5, 7), 0.2) evaluate to?
Define a function called circumference, that when passed in a diameter d, returns the circumference of a circle with diameter d.
Use the built-in
PIvariable/constant to get the value of pi.
Define a function that takes in two integer values a and b, and prints out all the even numbers between a and b inclusive.
Given the following definition of a function baz:
float baz(int num) {
return num * 10.0;
}Determine if the following function calls are valid. Explain why or why not.
baz(20.0/5);baz(100/5);baz(baz(5));
Given the following fragment of code:
foo(3, 'H', true);
int a = foo(4, 'b', false);
int b = foo(a, 'C', false);Write a function signature for the function foo.