Doubts about an algorithm problem

Asked

Viewed 53 times

-4

inserir a descrição da imagem aqui

I do not understand what the question asks to do, someone can give me a light?

  • maybe what you haven’t understood is that p symbol % returns the rest of the division ex. 5%100 = 5.

  • The operator is the entire division operator (150/100 gives 1.5 and 150/100 gives 1). The % operator is the rest division operator (or module) (13%10 gives 3). Suppose you enter the number 1234, the result would be: d: 1, a: 2, b: 3, c: 4.

2 answers

1

Speak up, Arashi, speak up! Then, the exercise prompts you to write the return of the 4 operations, concatenated with the text "Result:" at the beginning of the text. In case you had any questions in surgery. The operator " " represents the entire division, so it is a division that takes only the entire part of the answer, discarding what comes after the comma. And the operator "%" does exactly the opposite, he does the splitting but keeps everything that is after the comma.

1


The algorithm will essentially separate the digits from the number you entered and display on the screen. Since the type is integer, then it will truncate the value of the expressions. Example: x = 5423

  • x/1000 -> 5
  • (x/100)%10 -> 4
  • (x%100)/10 -> 2
  • (x%10)%10 -> 3

Browser other questions tagged

You are not signed in. Login or sign up in order to post.