Found 9326 Articles for Object Oriented Programming

Check Average of Odd Elements or Even Elements are Greater in Java

Mr. Satyabrata
Updated on 05-Jan-2023 11:45:21

404 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to find the sum of all even and odd numbers in a given array and compare them to see which one is greater. Note − The array must be an integer array. Let’s explore the article to see how it can be done by using Java programming language. To Show You Some Instances Instance-1 Suppose the original array is {14, 49, 55, 67, 72, 82} After finding average of sum of even and ... Read More

Check if Array is Free From 0 and Negative Number in Java

Mr. Satyabrata
Updated on 05-Jan-2023 11:39:58

2K+ Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to check and confirm the array is free from 0 and negative numbers. Let us say that an array contains 0 or a negative element then the result should pop up that "Array contains 0 or a negative number." Otherwise, the result should be "Array doesn’t contain 0 or a negative number." Note − The array must be an integer array. Let’s explore the article to see how it can be done by using ... Read More

Arrange Negative Array Elements Before Positive Elements in Java

Mr. Satyabrata
Updated on 05-Jan-2023 11:33:51

740 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to arrange all elements of array such that negative elements are present before positive elements. If a number is greater than 0 then it is called as positive number, if less than 0 then it is called as negative number. Note − The array must be an integer array. Let’s explore the article to see how it can be done by using Java programming language. To Show You Some Instances Instance-1 Suppose the ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:27:19

6K+ Views

A number is said to be a tech number, when an even digit number is divided into exactly two parts and the square value of the sum of those two numbers is equal to the original number. For more clarification, we take a number which has even digits. After that, divide it into two parts and add two parts. After getting the sum value, we calculate the square of it. Now we compare both the calculated square value and the original/input number. If both are same then we can say that the input number is a tech number otherwise ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:24:06

346 Views

A number is said to be a Tcefrep number, if the reverse of that number is equal to the sum of the proper divisors of the original number. For more clarification, we find the sum of the divisors of a number and find the reverse of the original number. If both the sum value and the reverse of the given number are the same then we can say that the given number is a Tcefrep number. Some examples of Tcefrep numbers are: 6, 498906, 20671542 ... etc. In this article, we will see how to check if a ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:19:14

2K+ Views

A number is said to be a Strontio number, if we multiply 2 with a four-digit number then in the resultant number the tens place and hundreds place digits are the same. In simple terms, Strontio numbers are basically four-digit numbers. When we multiply 2 with it, it results in a number whose tens place and hundred places are exactly the same. Some examples of Strontio numbers are- 1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 1001 ... etc. In this article, we will see how to check if a number is a strontio number by using Java ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:17:02

573 Views

A number is said to be a pointer prime number, if the sum of the product value of digits and the original prime number results in the next prime number. For more clarification, we take a prime number and multiply the digits with each other and add that multiplication value with the original number. After that if we get another prime number which is next to the original prime number. Then we can say that the number is a pointer prime number. Some examples of pointer prime numbers are: 23, 61, 1123, 1231 ... etc. In this article, ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:12:36

2K+ Views

A number is said to be a narcissistic number, if the addition value of each digit raised to the power of numbers of digits available in the original number is equal to the original number. For more clarification, if the original number has ‘n’ number of digits, first we have to calculate the nth power of each digit. Then add those value and check if that calculated value and original number both are same then the original number is called as narcissistic number. Some examples of narcissistic numbers are: 153, 8208, 4210818, ... etc. In this article, we will ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:08:10

1K+ Views

A prime number is said to be a Mersenne number, if the number satisfy the expression of M(n)= 2n-1, where ‘n’ is an integer. Let, ‘n’ is an integer. If 2n -1 is equal to the prime number, then that number is known as mersenne number Some examples of Mersenne numbers are: 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095 ... etc In this article, we will see how to check if a number is a Mersenne number by using Java programming language. To show you some instances Instance-1 Input number is 15. Let’s check ... Read More

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

Mr. Satyabrata
Updated on 09-Dec-2022 10:04:04

215 Views

A number is said to be an empire number, if after reversing a prime number we get another prime number. In this article, we will see how to check if a number is an empire number by using Java programming language. To show you some instances Instance-1 Input number is 13. Let’s check it by using the logic of the Empire number. 13 is a prime number. If we reverse 13, then we get = 31 As we notice here both the reversed number and input number both are prime numbers. Hence, 13 is an empire number. Instance-2 ... Read More

Advertisements