113k views
4 votes
Assign to the boolean variable 'possiblecandidate' the value false if the int variable 'n' is even and greater than 2, or if the variable 'n' is less than or equal to 0; otherwise, assign true to 'possiblecandidate'. assume 'possiblecandidate' and 'n' are already declared and 'n' assigned a value.

2 Answers

1 vote

Answer:

possiblecandidate = true;

if( ( ( n >= 2 ) && ( n % 2 == 0 ) ) || ( n <= 0 ) )

possiblecandidate = false;

Step-by-step explanation:

User Alexalejandroem
by
7.7k points
6 votes
possiblecandidate = true;
if( ( ( n >= 2 ) && ( n % 2 == 0 ) ) || ( n <= 0 ) )
possiblecandidate = false;
User Gouri Joshi
by
6.7k points