Tech Number in JavaIn this section, we will learn what is tech number and how can we find tech numbers through a Java program. Tech NumberA number is called a tech number if the given number has an even number of digits and the number can be divided exactly into two parts from the middle. After equally dividing the number, sum up the numbers and find the square of the sum. If we get the number itself as square, the given number is a tech number, else, not a tech number. For example, 3025 is a tech number. Tech Number ExampleLet's take an example and check 2025 and 1312 are tech numbers or not. Steps to Find Tech numberThe base condition to check the tech number is that the number must contain an even number of digits. If so, we will move to the next step, else will not execute the code further. Let's see the steps.
Tech Number Java ProgramLet's create a Java program and check whether the number is tech or not. TechNumberExample1.java Output 1: Enter a number to check: 2025 2025 is a tech Number. Output 2: Enter a number to check: 9181 9181 is not a tech number. Let's find all the tech numbers between a specified range. TechNumberExample2.java Output: Tech numbers between 1 to 1000000 are: 1 2025 3025 9801 10000 Let's see another logic for the same. TechNumberExample3.java Output: Enter the number to check: 3025 The given number is a tech number.
Next TopicJava HTTP Proxy Server
|