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

Tell the value of the underlined digit 17,874,000,000 the 1 is underlined
3.7 times 9.4 show work
how can i solve 5.5x+32=57
Angelina bought a 64 ounce can of lemonade mix. She uses 4 ounces of mix for each pitcher of lemonade. How me pitcher of lemonade angelina make from the can of
what is the reference angle of 330° degrees
Angelina bought a 64 ounce can of lemonade mix. She uses 4 ounces of mix for each pitcher of lemonade. How me pitcher of lemonade angelina make from the can of
What is 25% of 6??? Is it 1.5?
Oxygen is denoted as 16O8. How many protons and neutrons does an oxygen atom have?
i am in 5th grade. jorrod's sports card holder can hold 9 cards on each page. how many pages will jarrod need if he has 75 sports card.solve using models. expla
What mass of water will fill a tank that is 100.0 cm long, 50.0 cm wide, and 30.0 cm high? Express the answer in grams.