Complete the code to define a function named greet.
void [1]() { printf("Hello!\n"); }
The function name should be greet to match the definition.
Complete the code to call the function greet inside main.
int main() {
[1]();
return 0;
}To call the function defined as greet, use greet();.
Fix the error in the function definition by completing the return type.
[1] greet() { printf("Hello!\n"); }
The function does not return a value, so its return type should be void.
Fill both blanks to create a function that adds two numbers and returns the result.
[1] add(int a, int b) { return a [2] b; }
The function returns an integer, so the return type is int. To add two numbers, use the + operator.
Fill all three blanks to create a function that checks if a number is even and returns 1 if true, else 0.
[1] is_even(int num) { if (num [2] 2 == 0) { return [3]; } else { return 0; } }
The function returns an integer, so use int. To check if a number is even, use the modulus operator % to get the remainder. If remainder is 0, return 1 to indicate true.