# Strontio Number in Java

In this section, we will learn what is a strontio number and also create Java programs to check if the given number is strontio. The strontio number program frequently asked in Java coding tests and academics.

## Strontio Number

Strontio numbers are those four digits numbers when multiplied by 2 give the same digit at the hundreds and tens place. Remember that the input number must be a four-digit number.

### Strontio Number Example

1386*2=2772, we observe that at tens and hundreds place digits are the same. Hence, 1386 is a strontio number. 1221*2=2442, digits at tens and hundreds place are the same. Hence, 1221 is a strontio number.

Some other strontio numbers are 1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 1001, 2002, 3003, etc.

## Steps to Find Strontio Number

1. Read or initialize a number N.
2. Multiply the given number (N) by 2.
3. Find remainder by dividing the resultant (from step 2) by 1000. Divide the resultant (from step 2) by 1000. It removes the first digit from the resultant.
4. Divide the resultant (from step 3) by 10. It removes the last digit from the resultant and gives a two-digit number.
5. Again, divide the two-digit number (from step 4) by 10, it gives the quotient. By using the modulo operator find the remainder.
6. Compare both remainder and quotient. If they are equal, the given number (N) is strontio, else not.

Let's understand the above steps mathematically.

1221         (from step 1)

1221×2=2442        & nbsp;(from step 2)

2442%1000=442          (from step 3)

442/10=44          (from step 4)

44/10=4          (from step 5)

44%10=4          (from step 5)

4=4          (from step 6)

We observe that tens and hundreds place have the same digits. Hence, the given number 1221 is a strontio number. Similarly, we can check other numbers also.

Let's implement the above steps in a Java program.

## Strontio Number Java Program

StrontioNumberExample1.java

Output 1:

```Enter the number: 1386
1386 is a strontio number.
```

Output 2:

```Enter the number: 7587
7587 is not a strontio number.
```

Let's create another Java program to check if the given number is strontio or not.

In the following program, we have used the same logic as above. The only difference is that in the following program we have performed each step separately. While in the above program, we have performed three to four steps in a single statement. The above program reduces the lines of code.

StrontioNumberExample2.java

Output 1:

```Enter the number: 1111
1111 is a strontio number.
```

Output 2:

```Enter the number: 1875
1875 is not a strontio number.
```

### Feedback   