# Python Program to Check Strontio Number or Not

In the previous article, we have discussed Python Program to Find nth Prime Number
Strontio numbers:

Strontio numbers are four-digit numbers that, when multiplied by two, produce the same digit in the hundreds and tens places. Keep in mind that the input number must be four digits.

example :

Let N= 1386

A number multiplied by 2= 1386*2=2772

2772%1000 =772

772/10 = 77

77/10 = 7

77%7= 7

if (77%7 == 77/10 ), then it is strontio number.

Therefore 1386 is strontio number.

some of the examples of strontio numbers are :

1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 1001, 2002, 3003, and other numbers.

Examples:

Example1:

Input:

Given number = 1001

Output:

The given number 1001 is strontio number

Example2:

Input:

Given number = 1234

Output:

The given number 1234 is not a strontio number

## Program to Check Strontio Number or Not.

Below are the ways to check a strontio number or not.

### Method #1: Using modulus Operator (Static Input)

Approach:

• Give the number as static input and store it in a variable.
• Multiply the given number a store it in another variable.
• Calculate the value of the above-obtained number modulus 1000 to get a remainder and store it in another variable say “a”.
• Divide the variable ‘a’ by 10 to remove the last digit and store it in another variable say ‘b’.
• Again divide the variable ‘b’ by 10 to remove the last digit (quotient)and store it in another variable say  ‘c’.
• Calculate the value of b%10 to get the remainder and store it in another variable say  ‘d’.
• Check if both the quotient and remainder are equal or not (c==d) using the if conditional statement.
• If the statement is true, then print “The given number is strontio number”.
• Else print “Not Stronio Number”.
• The Exit of the Program.

Below is the implementation:

# Give the number as static input and store it in a variable.
num = 1001
# Multiply the given number a store it in another variable.
mul_numb = num*2
# Calculate the value of the above-obtained number modulus 1000 to get a remainder
# and store it in another variable say "a".
a = mul_numb % 1000
# Divide the variable 'a' by 10 to remove the last digit and store it in
# another variable say 'b'.
b = a//10
# Again divide the variable 'b' by 10 to remove the last digit (quotient)and
# store it in another variable say  'c'.
c = b//10
# Calculate the value of b%10 to get the remainder and store it in another variable
# say 'd'.
d = b % 10
# Check if both the quotient and remainder are equal or not (c==d) using the if conditional statement.
if(c == d):
# If the statement is true, then print "The given number is strontio number".
print("The given number", num, "is strontio number")
else:
# Else print "Not Stronio Number".
print("The given number", num, "is not a strontio number")


Output:

The given number 1001 is strontio number

### Method #2: Using modulus Operator  (User Input)

Approach:

• Give the number as user input using the int(input()) function and store it in a variable.
• Multiply the given number a store it in another variable.
• Calculate the value of the above-obtained number modulus 1000 to get a remainder and store it in another variable say “a”.
• Divide the variable ‘a’ by 10 to remove the last digit and store it in another variable say ‘b’.
• Again divide the variable ‘b’ by 10 to remove the last digit (quotient)and store it in another variable say  ‘c’.
• Calculate the value of b%10 to get the remainder and store it in another variable say  ‘d’.
• Check if both the quotient and remainder are equal or not (c==d) using the if conditional statement.
• If the statement is true, then print “The given number is strontio number”.
• Else print “Not Stronio Number”.
• The Exit of the Program.

Below is the implementation:

# Give the number as user input using the int(input()) function and
# store it in a variable.
num = int(input("Enter some random Number = "))
# Multiply the given number a store it in another variable.
mul_numb = num*2
# Calculate the value of the above-obtained number modulus 1000 to get a remainder
# and store it in another variable say "a".
a = mul_numb % 1000
# Divide the variable 'a' by 10 to remove the last digit and store it in
# another variable say 'b'.
b = a//10
# Again divide the variable 'b' by 10 to remove the last digit (quotient)and
# store it in another variable say  'c'.
c = b//10
# Calculate the value of b%10 to get the remainder and store it in another variable
# say 'd'.
d = b % 10
# Check if both the quotient and remainder are equal or not (c==d) using the if conditional statement.
if(c == d):
# If the statement is true, then print "The given number is strontio number".
print("The given number", num, "is strontio number")
else:
# Else print "Not Stronio Number".
print("The given number", num, "is not a strontio number")


Output:

Enter some random Number = 5555
The given number 5555 is strontio number

Explore more instances related to python concepts from Python Programming Examples Guide and get promoted from beginner to professional programmer level in Python Programming Language.