Found 7442 Articles for Java

How To Find Minimum Height of the Triangle with Given Base and Area in Java?

Vivek Verma
Updated on 05-Jun-2025 21:31:57

675 Views

The height of a triangle is the perpendicular distance from a vertex to the line containing the opposite side (which is the base). The height is also known as altitude. What is Minimum Height? The minimum height of a triangle refers to the shortest possible altitude (perpendicular distance) from a vertex to the opposite side (base). The following diagram provides you with a clear idea of the triangle's height and its base: A triangle is a polygon (a basic shape in geometry) that has three sides and three corners. The corners, also called vertices, are zero-dimensional points, while ... Read More

How To Check Whether a Number is a Unique Number or Not in Java?

Vivek Verma
Updated on 05-Jun-2025 21:29:25

11K+ Views

What is Unique Number? A Unique number is a number that does not have a single repeated digit in it. In other words, a number in which all the digits are present exactly only one time. For example, consider the number 12. The digits 1 and 2 each appear only once, the number is unique as it contains all distinct digits. Here are some other examples of unique numbers such as 132, 1, 45, 98, 701, 5, 12, 1234, etc. Input & Output Scenarios Below are the few of the input and output scenarios which gives some idea about ... Read More

How to Check Whether a Number is a Triangular Number or Not in Java?

Vivek Verma
Updated on 13-Jun-2025 12:16:58

4K+ Views

A Triangular number of a natural number n, which is defined as the sum of all natural numbers starting from 1 to n. It is called triangular as we can represent it in the form of an equilateral triangular grid by using the total number of points where the row number equals the point number, which means in the 1st row 1 point, in the 2nd row 2 points, in the 3rd row 3 points, and so on. Examples of triangular numbers are 1, 3, 6, 10, 21, 55, etc. In simple terms, we can say a number is a ... Read More

How To Check Whether a Number is a Sunny Number or Not in Java?

Vivek Verma
Updated on 05-Jun-2025 21:27:06

8K+ Views

What is Sunny Number? A number is said to be a Sunny number if the square root of the next value of the given number is a perfect square of any number. For example, let's consider the number 3. If we take the number after 3, which is 4, and 2 is its perfect square root. Here are some other examples of sunny numbers such as 3, 8, 15, 24, 35, 48, 63, etc. Input & Output Scenarios Following are some input and output scenarios that provide a better understanding of the sunny number: Scenario 1 Suppose the given input ... Read More

How To Check Whether a Number Is a Niven Number or Not in Java?

Vivek Verma
Updated on 05-Jun-2025 21:24:10

11K+ Views

What is Niven Number? A Niven number is a number that is completely divisible by the sum of its digits. For example, consider the number 20. If we calculate the sum of its digits, 2 + 0, we get 2. When we divide 20 by 2 (20 / 2), the remainder is 0 (which means it is completely divisible). Here are some other examples of Niven numbers such as 1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, etc. Input & Output Scenarios The following input and output scenarios will give you an idea of how to ... Read More

How to Check Whether a Number is Krishnamurthy Number or Not in Java?

Vivek Verma
Updated on 05-Jun-2025 21:23:36

9K+ Views

What is the Krishnamurthy Number? The Krishnamurthy number is a number which the sum of the factorials of all its digits is equal to the original number. These numbers are also called the Strong number, Special number, and the Peterson number. For example, let's take the number 40585. Now, calculate the sum of the factorials of its digits: 4! + 0! + 5! + 8! + 5!. The sum is equal to 40585. If you compare it with the original number, you can see that both are the same. Here are some other examples of Krishnamurthy numbers, such as 1, 2, ... Read More

How To Check Whether a Number is a Keith Number or Not in Java?

Vivek Verma
Updated on 13-Jun-2025 12:37:22

3K+ Views

What is Keith Number? A number is said to be a Keith number if it is arranged with a special sequence of numbers, which are initially created by its digits. The number sequence will be generated by adding its previous numbers till the number exceeds the input number. The results will be decided if the end number is exactly the same as the input number. For example, let's consider the number 14. The sequence will be as follows: s1 = 1, 4 s2 = 1, 4, 1 + 4 s3 = 1, 4, 5, 4 + 5 s4 = ... Read More

How To Check Whether a Number Is a Insolite Number or Not in Java?

Vivek Verma
Updated on 05-Jun-2025 21:02:14

456 Views

What is Insolite Number? An Insolite number is a number if it is divisible by both the addition of squares of each digit and the square of the whole product value of all digits. For example, we have a number 123, first, we need to find the sum of squares of each digit (sum of square = 1^2 + 2^2 + 3^2), and then we have to multiply each digit of the given number (product = 1 x 2 x 3). Now, we have to calculate the square value of the product (product square = (1 x 2 x 3)^2). ... Read More

How To Check Whether a Number is a Harshad Number or Not in Java?

Vivek Verma
Updated on 05-Jun-2025 20:56:15

2K+ Views

What is Harshad Number? A Harshad number is an integer that is completely divisible by the sum of its digits, which means that there is no remainder when the number is divided by this sum. For example, consider the number 81. If we calculate the sum of its digits (8 + 1), which is 9. Divide the number 81 by the sum result 9, there will be no remainder, The number 81 is a Harshad number. Here are some other examples of Harshad numbers such as 1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, etc. In ... Read More

How To Check Whether a Number Is a Fascinating Number or Not in Java?

Vivek Verma
Updated on 29-May-2025 18:48:33

5K+ Views

What is Fascinating Numbers? A Fascinating number is a number if the result of concatenation of the (original) number with its multiples of 2 and 3 contains all the digits from 1 to 9. For example, we have the number 192. Its product with 2 is 384, and with 3 is 576. Now concatenate (don't add) these with the original number: "192" + "384" + "576" = "192384576", which contains all the digits from 1 to 9 exactly once. Here are some other fascinating numbers, suchas: 192, 1920, 2019, 327, etc. Note: For a number to be a fascinating number, ... Read More

Advertisements