Ask Question

Define the function isEven which returns True, if a given number is even and returns False, if the number is odd. Execute the statement isEven (43) and display the output.

+1
Answers (1)
  1. 2 August, 18:39
    0
    Program:

    #include / /header file

    char * isEven (int number) / /function

    {

    if (number%2==0)

    return "True";

    else

    return "False";

    }

    int main () / /mainfunction

    {

    printf ("%s", isEven (43)); / /calling and display output.

    return 0; / /return statement.

    }

    Output:

    The above program gives as 45 output.

    Explanation:

    The above program is in c-language, The above function is used to check the number is even or odd. If the number is even it returns true and if the number is odd, it returns false. The print statement called that function while passing the number on the argument and print the result of the function. The char * is used in return type because the function returns the string value.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Define the function isEven which returns True, if a given number is even and returns False, if the number is odd. Execute the statement ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers