Found 2616 Articles for Java

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

Mr. Satyabrata
Updated on 27-Oct-2022 13:11:42

6K+ Views

Krishnamurthy number can be defined as a number when the sum of the factorial of all digits is equal to the original number. This Krishnamurthy number is also called the Strong number, Special number and Peterson number. To show you some instances Instance-1 Input number is 1 Let’s check it by using the logic of Krishnamurthy number − 1 = 1! = 1 which is equal to the original number. Hence, 1 is a Krishnamurthy number. Instance-2 Input number is 145 Let’s check it by using the logic of Krishnamurthy number − 145 = 1! + 4! + ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 12:42:34

1K+ Views

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. After that the numbers of the sequence will be generated by adding its previous numbers till the number is exceeded from the input number. The results will be decided if the end number is the same as input number. While adding the previous numbers during generating sequence remember to add nth numbers only where n refers to the number of digits in the original input number. In this article we will see how to ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 12:35:07

257 Views

A number is said to be an Insolite number, if the number is divisible by both addition of squares of each digit and square of the whole product value of all digits. For more clarification, we have to find the addition of squares of each digit. Then we have to multiply each digit of the given number and after that we have to calculate the square value of it. If the given number is divisible by both the resultant values, then we can say that the given number is an Insolite number. In this article we will see how to ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 12:17:46

2K+ Views

Harshad number can be defined as a number which is divisible by the sum of its digits. Simply it means if the sum of the digits of the number is a factor of that number then it is a Harshad number. In this article we will see how to check Harshad numbers by using the Java programming language. To show you some instances Instance-1 Input number is 18 Let’s check it by using the logic of Harshad number − Sum of the digits of the number = 1 + 8 = 9. So, 18 is divisible by 9. Hence, 18 ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 12:07:14

4K+ Views

Fascinating number can be defined as a number which when multiplied with 2 and 3, and then the products after being concatenated with the number itself contains all the digits from 1 to 9. For a number to be a fascinating number it should be three or more than three digit. To show you some instances Instance-1 Input number is 327 Let’s check it by using the logic of Fascinating number − 327 * 2 = 654 327 * 3 = 981 Concatenating “654” + “981” + “327” = 654981327 Hence, 327 is a Fascinating number. Instance-2 Input number ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 11:54:40

3K+ Views

A number is said to be an Evil number, if the number of 1’s present in the binary conversion of the given number is even. For more clarification, we have to first convert the given number into binary number. After converting we have to calculate how many ones are present. If the numbers of 1’s is even times then we can say the given number is an Evil number. If the numbers of 1’s is odd times then we can say the given number is an Odious number. In this article we will see how to check if a number ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 11:46:59

2K+ Views

Bouncy number can be defined as a positive number whose digits do not follow increasing or decreasing order. Means the digits are in an unsorted manner. There are no bouncy numbers between 1 to 100. To show you some instances Instance-1 Input number is 101 Let’s check it by using the logic of Bouncy number − 1 > 0 and 0 < 1 Hence, 101 is a Bouncy number. Instance-2 Input number is 905 Let’s check it by using the logic of Bouncy number − 9 > 0 and 0 < 5 Hence, 905 is a Bouncy number. ... Read More

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

Mr. Satyabrata
Updated on 27-Oct-2022 10:00:23

6K+ Views

Pronic number can be defined as a number when it is a product of two consecutive integers. Mathematically, the Pronic number is in the form of n(n+1). It is also called as heteromecic number, oblong number or rectangular number. To show you some instances Instance-1 Input number is 12 Let’s check it by using the logic of pronic number − 4 * 3 = 12, where 3 and 4 are two consecutive numbers. Hence, 12 is a pronic number. Instance-2 Input number is 30 Let’s check it by using the logic of pronic number − 5 * 6 = ... Read More

How To Check If Three Points are Collinear in Java?

Mr. Satyabrata
Updated on 27-Oct-2022 09:32:46

1K+ Views

Three points are said to be collinear if all the three points lie on a straight line. If the points do not lie on the same straight line, then they are not collinear points. It means if three points (x1, y1), (x2, y2), (x3, y3) are on the same straight line then collinear. Where, x1, y1, x2, y2, x3, y3 are the points on x and y axis and (x1, y1), (x2, y2), (x3, y3) are the coordinates. Mathematically, there are two ways to know that three points are collinear or not. By finding the area of a triangle using ... Read More

How To Check if a Triangle is Valid or Not When Sides are Given in Java?

Mr. Satyabrata
Updated on 27-Oct-2022 09:23:03

6K+ Views

As we know a triangle is a polygon which has 3 sides. It consists of three sides and three vertices. Three internal angles sum up to 180 degrees. In a valid triangle, if you add any two sides then it will be greater than the third side. As per our problem statement we have to check if a triangle is valid or not if three sides are given by using Java programming language. So, we have to check if the three conditions below are satisfied or not. If satisfied then triangle is a valid else triangle is not valid. Suppose ... Read More

Advertisements