[291 views]

A number is said to be a Tech number when it has even number of digits and the number can be split into two parts, where the square of the sum of the two halves is equal to the original number. For example: 2025, 3035, etc.

Let us consider the number 2025:

Number of digits: 4

2025 can be split into: ‘20’ and ‘25’

Square of sum of the numbers: (20+25)^{2} = 45^{2} = 2025

Therefore, 2025 is a Tech number.

In this article, we will learn about the algorithm and flowchart to check whether a given number is Tech number or not, followed by a brief explanation of the algorithm for better understanding.

In this problem, we need to check whether a given number is a Tech number or not. To check this, we need to find out the number of digits of the number first. If the number of digits is even, we have to divide the number into two equal halves. If the square of the sum of these halves is equal to the original number, then the given number is a tech number.

The algorithm starts off by taking the number to be checked as user input. The value is then stored in a variable, say ‘n’. We keep a copy of this number in a variable ‘num’. We now initialize number of digits in the number as zero. To count the number of digits, we start a loop that runs until the number is greater than zero. In each iteration, we increment the digit and remove the last digit of the number. Once we get the total digits, we check whether digit is even or odd. If digit is even, we divide the number into two parts. The first part is equal to the first digit/2 digits of the number and the second part contains the last digit/2 digits.

Once we get these numbers, we find out the square of the sum of these numbers. If the sum is equal to the original number ‘n’, then we display “Tech Number”, else we display “Not Tech Number”. If the number of digits is odd, we display “Tech Number”, else we display “Not Tech Number”.

Note: Here ‘%’ is the modulus operator which returns the remainder value after division.

Let us consider an example:

Let num = 3035

digit = 4

firsthalf = 30

secondhalf = 35

sum = (30+35)^{2}

= 652

=3035

Therefore, sum = num = 3035.

Hence, 3035 is a tech number.

- Algorithm and Flowchart to find the smallest element in an array
- Algorithm and flowchart to check whether two numbers are coprime or not
- Algorithm and Flowchart to find the Maximum Absolute Difference Among the given Array
- Algorithm and Flowchart to check whether a number is twisted prime or not
- Algorithm and flowchart to find Frequency of Characters in Sentence

- Algorithm and Flowchart to find if a Number is Even or Odd
- Algorithm and Flowchart to find whether a number is Prime Number or Not
- Algorithm and Flowchart for Armstrong Number
- Algorithm for Finding Factorial of a Number
- Algorithm and Flowchart to Calculate Fibonacci series up to n
- How to round a number to nearest integer using python
- Can we have DB table without a primary key?
- Why does everyone hate Java?
- How much JavaScript to learn for Web Development
- How to store password like sensitive information in application