What are the strontio numbers in Java?

In this blog, we will learn about strontio numbers and methods of strontio numbers in Java with the help of examples.

Among the various and unique numerologies in mathematics, the strontio number stands out with its unique and captivating property. Let’s see what makes strontio numbers so special and uncover the hidden patterns they reveal.

Strontio number in Java

Definition:

Strontio numbers in Java are 4-digit numbers when multiplied by 2, giving the same digit at the tens and hundreds place of the output.
It’s important to note that the number should neither greater than 4-digit nor lesser than it, So it should always be of exact 4-digit which ranges from [1000 – 9999].

Some examples of strontio numbers are:
1111 => 1111*2 = 2222
1386 => 1386*2 = 2772

So let’s see the algorithm to check whether the number is strontio number or not.

ALGORITHM:
Step 1: Get the input of the integer number exactly the 4-digit.
Step 2: Multiply the number by 2 and in the result, remove all the digits except tens place and hundreds place.
Step 3: Check whether both numbers are the same or not.
Step 4: So if both numbers are the same then it will be a strontio number else it will not

Code to check whether the number id strontio or not.

import java.util.*;
class Strontio {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a four digit number: "); 
      
       int InNo=sc.nextInt();  //Store the number in declared variable
       int tem= InNo;          //Store the input value temporarily
     
      InNo=(InNo*2%1000)/10; //remove all digits other than 10's and 100's places

      if(InNo%10==InNo/10)  //compare both the numbers of 10's and 100's places
         System.out.println(tem+ " is a strontio number.");
      else
         System.out.println(tem+ " is not a strontio number.");
    }
}

Output:
IF the input number is 5555:

5555 is a strontio number.

IF the input number is 7587:

7587 is not a strontio number.

Conclusion :
In conclusion, finding strontio numbers is simple. First, take a four-digit number and multiply it by 2. Next, look at the hundreds and tens digits of the result. If these two digits are the same, then the number is a Strontio number. This easy process shows the special pattern of strontio numbers and makes understanding them fun and straightforward.

There are many similar numbers in mathematics like Armstrong Number: An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For example, 153 is an Armstrong number. You can refer the https://www.javatpoint.com/armstrong-number-in-java

You can also refer the post https://coderspacket.com/posts/how-to-remove-last-n-number-of-elements-from-an-array-in-java/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top