Home java Did the number of integer on 10?

# Did the number of integer on 10?

Author

Date

Category

Simple number `INT `.
It is necessary to determine whether it is divided by 10 integer.
Everything seems to be simply, but nothing in mind is coming. Help please.

Use for this kind of tasks The `% `statement, which returns the left value from the division left value on right .

Example:

``````number = 10;
if (Number% 10 == 0) System.out.PrintLN ("The number is divided into 10");
``````

For this, there is a “%” operator, the result of which is the balance of the division.

With it, this task is solved quite trivial:

``````int a = 15;
if (a% 10 == 0) // In our case, the result will be 5, then the check will not pass
{
// divided by 10 integer
...
}
ELSE.
{
// Not divisible
...
}
``````

Here is a simple feature for checking. If it is divided – returns TRUE, otherwise – false.

``````Public Boolean Byten (int n) {
RETURN N% 10 == 0;
}
``````

You need to use the balance of division, which means that you need

``````int number = 10;
if (Number% 10 == 0) {
System.Out.Pritln (Number);
}
``````

That is, learn the match)

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.