
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

1K+ Views
In this article, we will understand how to check if an array contains a given value using two methods: Linear search and the HashSet class. For Linear Search, we will iterate through the array elements, comparing each element with the given input. For the HashSet class, we will utilize the contains() method to achieve this efficiently. Problem Statement Write a Java program to check if an array contains the given value − Input 1 Enter the number to be searched: 25 The elements in the integer array: 15 20 25 30 35 Output 1 The array contains the given value ... Read More

1K+ Views
In this article, we will learn to check whether the number is positive or negative in Java. To check whether the specified number is positive or negative can be determined with respect to 0. A number greater than 0 is considered a positive number whereas a number less than 0 is considered a negative number, we can use Java conditional statements like if-else-if blocks or ternary operators. Before that let's discuss the problem statement with the help of examples − Problem Statement Given an integer number as an input, write a Java program to check whether the number is positive ... Read More

2K+ Views
We are given an integer number as input, and our task is to write a Java program to check whether that number is even or odd. If a number is divisible by 2, then it is an even number otherwise, it is odd. To verify a given number is even or odd in Java, we can use 3 different ways one with the modulus operator (%), another with the bitwise AND operator (&), and a third one using a switch statement. Example Scenarios: Let's understand the problem statement with some example scenarios: Input: number = 45 Output: result = odd ... Read More

580 Views
In this article, we will learn how to find the sum of N numbers using recursion in Java. Recursion is when a method calls itself repeatedly until a base condition is met. In Java, each recursive call is placed on the stack until the base case is reached, after which values are returned to calculate the result. To solve with recursion, we need to divide our problem into smaller chunks, then find out solution for that smaller part, and that will be our base condition. In this problem, to find the sum of N numbers using recursion, we can store ... Read More

709 Views
In this article, we will understand how to find the product of two numbers using recursion in Java. A recursive function is a function that calls itself multiple times until a particular condition is satisfied. Product of two Numbers Using Recursion Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function. To find the product of two numbers, let's say a and b, using recursion, the base case will be (if y = 0, ... Read More

1K+ Views
In this article, we will understand how to find the sum of the digits of a number using recursion in Java. A recursive function is a function that calls itself multiple times until a particular condition or base condition is met. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function. Problem Statement Write a program in Java to find the sum of the digits of a number using recursion. Below is a demonstration of the same. Input Enter the number : 12131415 ... Read More

597 Views
In this article, we will learn to pass a lambda expression as a method argument in Java. A lambda expression is a short block of code that takes in parameters and returns a value. Lambda Expression Lambda expressions allow passing functionality as a method parameter, reducing the need for anonymous classes. They are often used in functional interfaces, especially when working with collections and streams. Problem Statement Given an Arraylist the goal is to reverse the strings present in it. Below is a demonstration of the same − Input ("Apple", "Orange", "Grapes") Output elppA, egnarO, separG Reversing Strings in ... Read More

1K+ Views
To calculate the power of a number, Java provides different ways to do this using loops, built-in methods, and recursion. In this article, we will learn how to calculate the power of a number using recursion. In Java, Recursion is a process in which a function calls itself multiple times until it reaches a base condition, and the corresponding function is called a recursive function. Problem Statement Given a base number and a power value, we need to calculate the result of raising the base to the power using recursion. Below is a demonstration of the same. Input: Enter ... Read More

634 Views
To return True if all entries of two arrays are equal, use the ma.allequal() method in Python Numpy. Returns True if the two arrays are equal within the given tolerance, False otherwise. If either array contains NaN, then False is returned.The fill_value sets whether masked values in a or b are considered equal (True) or not (False). A masked array is the combination of a standard numpy.ndarray and a mask. A mask is either nomask, indicating that no value of the associated array is invalid, or an array of booleans that determines for each element of the associated array whether ... Read More

354 Views
To clip (limit) the values in an array, use the np.ma.clip() method in Python Numpy. The "out" parameter is where results will be placed in this array. It may be the input array for in-place clipping. out must be of the right shape to hold the output. Its type is preserved. . Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1. Equivalent to but faster than np.minimum(a_max, np.maximum(a, a_min)).The function returns an array ... Read More