Found 7442 Articles for Java

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:46:33

1K+ Views

A number is said to be an ugly number, if the prime factors of that input number only include 2, 3 and 5. Maybe some number has some prime factors which have only one factor or two factors but those factors must be one of 2, 3, and 5. In this article we will see how to check if a number is an Ugly number or not by using Java programming language. To show you some instances Instance-1 Input number is 20. Let’s check it by using the logic of Ugly number. Prime factors of 20 = 2, 2, 5 ... Read More

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:43:09

20K+ Views

A number is said to be a Strong number, if the sum of factorials of the input number’s every digit is equal to the same input number. For more clarification, we have to find the factorial of every digit of the given number. After that we have to calculate the sum of those factorials. Then we have to compare both the sum value and input number, if they are same then the given number is a strong number otherwise it is not a strong number. In this article, we will see how to check if a number is a strong ... Read More

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:35:11

2K+ Views

A number is said to be a Spy number, if the sum of the digits of the given number is equal to the product of the digits of the given number. For more clarification, we have to first calculate the sum of the digits of the given number. After that we have to calculate the product of the digits of the given number. Then we have to compare both the sum value and product value, if they are the same then the given number is a spy number otherwise it is not a spy number. In this article, we will ... Read More

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

Mr. Satyabrata
Updated on 17-Nov-2022 11:31:24

6K+ Views

A number is said to be a Special number, if the sum of factorials of the input number’s every digit is equal to the same input number. For more clarification, we have to find all the factors of every digit of the given number. After that we have to calculate the sum of those factorials. Then we have to compare both the sum value and input number, if they are the same then the given number is a special number otherwise it is not a special number. In this article, we will see how to check if a number is ... Read More

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

Vivek Verma
Updated on 13-Jun-2025 12:26:57

5K+ Views

What is Goldbach Number? A number is said to be a Goldbach number if the number can be expressed as the addition of two odd prime number pairs. For example, let's consider the number 98 and find the pairs of prime numbers (19, 79). If you calculate the sum of 19 + 79, you get 98, so 98 is a Goldbach number. If we follow the above condition, then we can find that every even number larger than 4 is a Goldbach number because it must have any pair of odd prime number pairs. But the odd numbers are not satisfying because we know ... Read More

How To Check if a Given Point Lies Inside a Rectangle in Java?

Vivek Verma
Updated on 13-Jun-2025 12:08:27

3K+ Views

A Rectangle is a closed two-dimensional shape that has 4 sides and 4 corners. The opposite sides are of the same length and parallel to each other. All 4 interior angles are equal, angles measure 90 degrees. It is a four-sided polygon. Following is the diagram of the Rectangle: Checking Points Inside Rectangle A point is said to lie inside a rectangle if its x and y coordinates are between the x and y coordinates of the opposite corners of the rectangle. To determine whether the point lies within the rectangle, we will use the following approaches: ... Read More

How to Calculate Area of Enneagon in Java?

Mr. Satyabrata
Updated on 17-Nov-2022 10:58:33

182 Views

An enneagon refers to a polygon with 9 sides with 9 internal angles. Where all the sides of the polygon are equal it is called a regular enneagon which has an internal angle of 140 degrees, and the sum of all internal angles are 1260 degrees. An enneagon is also referred to as Nonagon. Area of enneagon can be calculated by using When Length of Side (s) is given Area = 6.1818 * (s * s) When circumradius (r) is given Area = 2.8925 * (r * r) When apothem (a) is given Area = 3.2757 * (a ... Read More

How To Find Volume of the Octahedron in Java?

Vivek Verma
Updated on 13-Jun-2025 12:38:19

191 Views

An octahedron is a three-dimensional (3D) shape which has eight plane faces. In other words, a polyhedron is called an octahedron which has eight faces, twelve edges, and 6 vertices. A polygonal is a three-dimensional figure with flat polygonal faces, straight edges, and sharp corners or vertices. The word octahedron is derived from the Greek word that is Oktaedron, which means Eight faces. Here is the diagram of the octahedron, which has side a: Volume of octahedron The volume of an octahedron is the amount of space occupied by the octahedron. To calculate the volume of an octahedron, we ... Read More

How To Find Volume of Dodecahedron in Java?

Vivek Verma
Updated on 13-Jun-2025 12:33:15

260 Views

A dodecahedron is a three-dimensional shape that has twelve flat faces. It is derived from two Greek words, i.e., 'dodeka', which means 12, and 'hedra', which means face. In other words, a dodecahedron is a special type of polyhedron that has 12 faces. To make a dodecahedron, you can use the 12 pyramids and the base as a pentagon. Following diagram will provide a better understanding of its shape and edges: Where a is the length of the edge. Volume of Dodecahedron A dodecahedron volume refers to the amount of space occupied by this 3D shape, which has 12 faces. ... Read More

How To Find the Midpoint of a Line in Java?

Vivek Verma
Updated on 06-Jun-2025 11:01:26

2K+ Views

Midpoint of a Line The midpoint refers to a point that is exactly in the middle of the line segment, which is joined through two points. These are the endpoints of a line segment and the midpoint lying in between these two points. The following diagram will provide a better understanding: Midpoint Formula The midpoint formula is defined for the points in the coordinate axes (i.e., x and y). Let's consider (x1, y1) and (x2, y2) are the endpoints of a line segment. The midpoint will be equal to half of the sum of the x-coordinates of the two ... Read More

Advertisements