Matrix Programs17 Mar 2025 | 1 min read Matrix relates to mathematics that can be defined as a 2-dimensional array in the form of a rectangle which is filled either with numbers or symbols or expressions as its elements. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix. Individual entries in the matrix are called element and can be represented by aij which suggests that the element a is present in the ith row and jth column. ![]() 1) Java Program to add the two matrices 2) Java Program to subtract the two matrices 3) Java Program to determine whether a given matrix is an identity matrix Next TopicJava Programs |
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going to discuss...
5 min read
In this program, we need to multiply two matrices and print the resulting matrix. Product of two matrices The product of two matrices can be computed by multiplying elements of the first row of the first matrix with the first column of the second matrix then, add...
6 min read
Java Convert Binary to Decimal We can convert binary to decimal in java using Integer.parseInt() method or custom logic. Java Binary to Decimal conversion: Integer.parseInt() The Integer.parseInt() method converts string to int with given redix. The signature of parseInt() method is given below: public static int parseInt(String s,int redix) Let's see...
2 min read
Java program to print the following pattern on the console Algorithm: STEP 1: START STEP 2: DEFINE i, j STEP 3: SET n=6 STEP 4: SET i=n. REPEAT STEP 5 to STEP 7 UNTIL i>0. STEP 5: SET j=0. REPEAT STEP 6 UNTIL j STEP 6: PRINT * and SET j=j+1 STEP...
2 min read
Java Convert Date to String We can convert Date to String in java using format() method of java.text.DateFormat class. format() method of DateFormat The format() method of DateFormat class is used to convert Date into String. DateFormat is an abstract class. The child class of DateFormat is SimpleDateFormat. It...
2 min read
File: CharacterPercentage .java import java.text.DecimalFormat; public class CharacterPercentage { static void charPercentage(String input) { int totalChar = input.length(); int upperCase = 0; int lowerCase = 0; int digits = 0; int others = 0; for (int i = 0; i < input.length(); i++) { char ch = input.charAt(i); if (Character.isUpperCase(ch)) { upperCase++; } else if (Character.isLowerCase(ch)) { lowerCase++; } else...
1 min read
In this program, we need to rotate the elements of array towards its right by the specified number of times. An array is said to be right rotated if all elements of the array are moved to its right by one position. One approach is...
4 min read
An array numArr[] is given, which only contains the non-negative integers, and an integer sp is also provided. The task is to partition the array into sp continuous subarrays such that the largest sum among these sp subarrays is minimum. Note that subarrays can never be...
19 min read
It is very interesting problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going to...
5 min read
In this section, we will learn what is a sphenic number and also create Java programs to check if the given number is sphenic or not. The sphenic number program frequently asked in Java coding tests and academics. Sphenic Number A positive integer n is called a sphenic...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India