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

24. Mi amigo Pablo __ de Ecuador. está es
Describe and explain Dally’s gift from Sodapop.
k(x)= 2x-3/x^2-4x-5 Find the domain
2. Five students reported the amount of time (in minutes) they spent studying for an AP Statistics test the night before the test. The mean of the reported time
The area of a circle, in terms of π , is 68 π m2. Find the value of the radius. Give your answer as a simplified surd. .
Determine the use of the prepositional phrase in the following sentence. The scenery was beautiful when we drove the car through the valley. adjective adverb
Someone help me with this please?​
Which of the following options is an equivalent function to f(x) = 2(5)2x
absulute maximum definition
find 116% of 75. please i need to show my work so please help with the work WITH THE WORK SHOWN