sandyykn4143 sandyykn4143
  • 03-10-2019
  • Computers and Technology
contestada

Write an algorithm which gets a number A, if it is even, prints even, and if it is odd prints odd.

Respuesta :

ExieFansler ExieFansler
  • 04-10-2019

Answer:

The algorithm to find A is even or odd.

  1. input A.
  2. Check the remainder on diving by 2 by A%2.
  3. If remainder is 1 then A is odd Print(Odd).
  4. If remainder is 0 print(Even).

Explanation:

To check if the number is even or odd we use modulo  operator(%).Which gives the remainder on dividing.So if we do this A%2 it will give the remainder that will come out on dividing the value of A by 2.

So if the remainder comes out is 1 then the number is odd and if the remainder is 0 then the number is odd.

Answer Link

Otras preguntas

which of the following help to develop your refusal skills
Find the critical numbers of the function. g(y) = y − 3 / y2 − 3y + 9
The past perfect tense is formed with had and the past participle. a. True b. False
How did Italian trading families play a role in the renaissance in Italy
4x = 24 + 6x 19 96 64 82
I need help someone explain?????
Which example provides a complete scientific description of an object in motion? Question 3 options: The marble changed position quickly. The car traveled
Which of the following sentences does NOT provide detail about the setting? A. Yvonne woke up bright and early in the morning. B. Shelby left work
Can anyone give me the answer to 18.. Part A and B...if u can explain too please
Consider this theme:Too much power can be dangerous.Which excerpt from Frankenstein best supports this theme? A."I was benevolent and good; misery made me a fie