Java Program to Add Two Binary Strings (original) (raw)
Java Basic Programs
- Java Program to Display All Prime Numbers from 1 to N For a given number N, the purpose is to find all the prime numbers from 1 to N. Examples: Input: N = 11Output: 2, 3, 5, 7, 11Input: N = 7Output: 2, 3, 5, 7 Approach 1: Firstly, consider the given number N as input.Then apply a for loop in order to iterate the numbers from 1 to N.At last, check if ea 4 min read
- Java Program to Check Whether the Character is Vowel or Consonant In this article, we are going to learn how to check whether a character is a vowel or a consonant. So, the task is, for any given character, we need to check if it is a vowel or a consonant. As we know, vowels are ‘a’, ‘e’, ‘i’, ‘o’, ‘u’ and all the other characters (i.e. ‘b’, ‘c’, ‘d’, ‘f’ …..) are 4 min read
- Java Program to Find Sum of Fibonacci Series Numbers of First N Even Indexes For a given positive integer N, the purpose is to find the value of F2 + F4 + F6 +………+ F2n till N number. Where Fi indicates the i'th Fibonacci number. The Fibonacci Series is the numbers in the below-given integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ……Examples: Input: n = 4 Output: 3 4 min read
Java Pattern Programs
Java Conversion Programs
Java Classes and Object Programs
Java Methods Programs
Java Searching Programs
Java 1-D Array Programs
- Java Program to Find Largest Element in an Array Finding the largest element in an array is a common programming task. There are multiple approaches to solve it. In this article, we will explore four practical approaches one by one to solve this in Java. Example Input/Output: Input: arr = { 1, 2, 3, 4, 5}Output: 5 Input: arr = { 10, 3, 5, 7, 2, 12 4 min read
- Java Program to Find Common Elements Between Two Arrays Given two arrays and our task is to find their common elements. Examples:Input: Array1 = ["Article", "for", "Geeks", "for", "Geeks"], Array2 = ["Article", "Geeks", "Geeks"]Output: [Article, Geeks] Input: Array1 = ["a", "b", "c", "d", "e", "f"], Array2 = ["b", "d", "e", "h", "g", "c"]Output: [b, c, d 4 min read
Java 2-D Arrays (Matrix) Programs
- Java Program to Add two Matrices Given two matrices A and B of the same size, the task is to add them in Java. Examples: Input: A[][] = {{1, 2}, {3, 4}} B[][] = {{1, 1}, {1, 1}} Output: {{2, 3}, {4, 5}} Input: A[][] = {{2, 4}, {3, 4}} B[][] = {{1, 2}, {1, 3}} Output: {{3, 6}, {4, 7}} Program to Add Two Matrices in JavaFollow the St 2 min read
- Java Program to Find Transpose of Matrix Transpose of a matrix is obtained by changing rows to columns and columns to rows. In other words, the transpose of A[ ][ ] is obtained by changing A[i][j] to A[j][i]. Example of First Transpose of MatrixInput: [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] , [ 7 , 8 , 9 ] ]Output: [ [ 1 , 4 , 7 ] , [ 2 , 5 , 8 ] 5 min read
- Java Program to Find the Normal and Trace of a Matrix For a given 2D matrix, the purpose is to find the Trace and Normal of the matrix. In this article, we will learn about Normal and Trace of a Matrix in Java. Examples : Input : matrix[][] = {{1, 4, 4}, {2, 3, 7}, {0, 5, 1}}; Output : Normal = 11 Trace = 5 Explanation : Normal = sqrt(1*1+ 4*4 + 4*4 + 3 min read
Java String Programs