Ask Question
15 November, 04:09

Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "Positive number" if isEven is false and is Positive is true. Print "Not a positive number" otherwise. End with newline.

+2
Answers (1)
  1. 15 November, 04:14
    0
    C code explained below

    Explanation:

    #include

    #include

    int main (void) {

    int userNum;

    bool isPositive;

    bool isEven;

    scanf ("%d", &userNum);

    isPositive = (userNum > 0);

    isEven = ((userNum % 2) = = 0);

    if (isPositive && isEven) {

    printf ("Positive even number");

    }

    else if (isPositive &&! isEven) {

    printf ("Positive number");

    }

    else{

    printf ("Not a positive number");

    }

    printf ("/n");

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "Positive ...” 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