Home python Explain why you need to use exactly 10 in this equation

Explain why you need to use exactly 10 in this equation





Danish a positive valid number X. Display its first digit after the decimal point.


x = float (input ())
Print (int (x * 10)% 10)

Explain why you need to use the number 10 in the equation where we took it, thank you in advance. Is it possible to some other way to solve this task?

Answer 1, Authority 100%

We use a decimal number system.

Multiplication of the top ten translates the first to the digit after the point in the discharge of units.

123.4 * 10 = 1234

Taking the residue from division by module 10 leaves only the discharge of units.

1234% 10 = 4

In the end, you find what you were looking for.

can be solved in many ways, but this, the cavity, the most logical.

Answer 2, Authority 50%

From there that we use the decimal number of the number of numbers. Do computations on a piece of paper and everything will become clear.

can be solved in another way, yes. And not even one.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions