Ask Question
2 June, 16:31

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.

+4
Answers (1)
  1. 2 June, 17:41
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers