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

why did the crowd gather outside central high school in little rock​
The family trip to Grandma's consisted of both a train ride and a car ride. The average speed of the train ride was 72 miles per hour, and the average speed of
jor bieden jay mall jow mama​
a gift wrapping store has 8 shapes of boxes, types of wrapping paper, and 12 different bows. How many different gift-wrapping options are available at this stor
The biggest problem facing George H. W. Bush when he became president was?
Complete each phrase with the word for the appropriate family member.
what is the inverse of function of f? f(x) = -7x - 4
Correct answer gets brainliest and 5 stars
Is it true that every whole number is a solution of x > 0? Use complete sentences to explain your reasoning.
How manures and composts are different?​