Tasks - Arrays #7
Replies: 37 comments
-
|
WAP to perform the addition of two matrices. public class AddMatrix { } public class MultiplyMatrix { } public class Merge { } public class LowerTriangle { } |
Beta Was this translation helpful? Give feedback.
-
|
1--WAP to perform the addition of two matrices. } ` 2--WAP to perform multiplication of two matrices. } ` 3--WAP to print the largest and the smallest elements in an array of numbers ` } 4--Given two sorted arrays, merge them into one array which will also be in sorted order. } ` 5--WAP to print the lower triangular matrix. } ` |
Beta Was this translation helpful? Give feedback.
-
Matrix Addition`public class MatrixAddition { } Matrix Multiplication`public class MatrixMultiplication { } Largest and Smallest in Array`public class MaxMinArray { } Merge Sorted Arrays`public class MergeSortedArrays { } Lower Left Matrix`public class LowerLeftMatrix { } |
Beta Was this translation helpful? Give feedback.
-
|
`Matrix Addition } Matrix Multiplication } } public class merge2SortedArrays { } Lower Triangle } ` |
Beta Was this translation helpful? Give feedback.
-
Addition of two Matrices`import java.util.Scanner; } Multiplication of two matrices`import java.util.Scanner; } Largest and smallest elements in an array`import java.util.Scanner; } Combine two sorted arrays into single sorted array`import java.util.Scanner; } Print lower triangular matrix`import java.util.Scanner; } |
Beta Was this translation helpful? Give feedback.
-
|
WAP to perform the addition of two matrices. public class AdditionMatrix { WAP to perform multiplication of two matrices. public class MultiplicationMatrix { } WAP to print the largest and the smallest elements in an array of numbers public class SmallLargeArray { } Given two sorted arrays, merge them into one array which will also be in sorted order. import java.util.*; public class MergeArrays { } WAP to print the lower triangular matrix. import java.util.*; public class LowerTriangle { } |
Beta Was this translation helpful? Give feedback.
-
|
` public class Add { } //Multiplication matrix public class Add { } //Larger and Smaller element in array public class LargeSmall { //Merge sorted arrays import java.util.Arrays; public class Merge { } //lower matrix traiangle public class Lower { } ` |
Beta Was this translation helpful? Give feedback.
-
|
matrix addition public class matrixaddition matrix multiplication public class matmulti largest and smallest element public class smallest lower triangular matrix public class LowerTriangle |
Beta Was this translation helpful? Give feedback.
-
|
WAP to perform the addition of two matrices. public class AddingMat { } |
Beta Was this translation helpful? Give feedback.
-
|
WAP to perform the addition of two matrices. class MatrixAddition { WAP to perform multiplication of two matrices. class MatrixMultiplication { } WAP to print the largest and the smallest elements in an array of numbers class LargestSmallestArray { class MergeArraySorted { class LowerTriangleMatrix { } |
Beta Was this translation helpful? Give feedback.
-
|
WAP to perform multiplication of two matrices. public class Multiplymatrices { } |
Beta Was this translation helpful? Give feedback.
-
|
1.Addition of two matrix } 3.Largest and Smallest element public class LargestAndSmallest { } 4.MergeTwoArray public class MergeTwoArray { } 5.Lower Triangle Matrix public class LowerTriangle { } |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
import java.util.*; public class Addition { }
import java.util.*; public class Multiplication { }
import java.util.*; public class maxAndMin { }
class sortedMerge { while (i < m && j < n) { }
import java.util.*; public class lowerTriangle { } |
Beta Was this translation helpful? Give feedback.
-
|
WAP to perform the addition of two matrices. } WAP to perform multiplication of two matrices. public class MultiplicationMatrix { } WAP to print the largest and the smallest elements in an array of numbers } Given two sorted arrays, merge them into one array which will also be in sorted order. } WAP to print the lower triangular matrix. } |
Beta Was this translation helpful? Give feedback.
-
WAP to perform the addition of two matrices.WAP to perform multiplication of two matrices.WAP to print the largest and the smallest elements in an array of numbersGiven two sorted arrays, merge them into one array which will also be in sorted order.WAP to print the lower triangular matrix. |
Beta Was this translation helpful? Give feedback.
-
|
`import java.util.Scanner; } `import java.util.Scanner; } ` `import java.util.Scanner; } `import java.util.Scanner; } } |
Beta Was this translation helpful? Give feedback.
-
|
**Max and Min numbers in array int temp=0, temp1=1; } System.out.println(temp); System.out.println(temp1); |
Beta Was this translation helpful? Give feedback.
-
|
-->Lower matrix of triangle |
Beta Was this translation helpful? Give feedback.
-
|
addition of matrix public class MatrixAddition { } } |
Beta Was this translation helpful? Give feedback.
-
WAP to perform the addition of two matrices.import java.util.*; class Addition { } WAP to perform multiplication of two matrices.import java.util.*; class Matrix_mul { } WAP to print the largest and the smallest elements in an array of numbersimport java.util.*; class Finding { } Given two sorted arrays, merge them into one array which will also be in sorted order.import java.util.*; class Combine { } WAP to print the lower triangular matrix.import java.util.*; class Lower { } |
Beta Was this translation helpful? Give feedback.
-
|
`Addition of two matrices public class AdditionMatrix {} } Multiplication of two matrices public class MatrixMult { } largest and the smallest elements in an array of numbers import java.util.Scanner; public class MinMaxInArray { } Given two sorted arrays, merge them into one array which will also be in sorted order import java.util.*; public class mergedSort { Print the lower triangular matrix import java.util.*; public class LowerTrianMatrix { } ` |
Beta Was this translation helpful? Give feedback.
-
|
Matrix Addition } static int[][] add(int A[][], int B[][], } public static void main(String[] args) { } Matrix Multiplication } static void multiplyMatrix(int row1, int col1, int A[][], int row2, int col2, int B[][]) { } public static void main(String[] args) { } Largest and Smallest in Array } Merge Sorted Arrays static void printArray(int[] array) { static void mergeArray(int[] a, int[] b, int[] c) { } public static void main(String[] args) { } Lower Left Matrix } |
Beta Was this translation helpful? Give feedback.
-
|
`Matrix Addition } Matrix Multiplication } } public class merge2SortedArrays { } public static void main(String[] args){ } Lower Triangle public static void main(String[] args){ } ` |
Beta Was this translation helpful? Give feedback.
-
|
1 } 2 public class Mulmat { 3 4 public class Largesmall { } 5 public class Sortmerge { } |
Beta Was this translation helpful? Give feedback.
-
|
Q1 MATRIX ADDITION } Q2 MATRIX MULTI public class MatrixMulti { } Q3 public class LargestSmallest { } Q4 merging 2 sorted arrays } Q5 LOWER TRIANGULAR MATRIX PRINT public class LowerTriangularMatrix { |
Beta Was this translation helpful? Give feedback.
-
|
public class MatrixAddition { int[][] m2 = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; for (int[] row : m) { } public class Multiplication { } public class Merge{ public static void main(String[] args){ int[] a = {5,7,9,10}; while (i < a.length && j < b.length) { } while (i < a.length) while (j < b.length) public class LowerTriangle { |
Beta Was this translation helpful? Give feedback.
-
5.LOWER TRIANGLE IN MATRIX |
Beta Was this translation helpful? Give feedback.
-
|
WAP to perform the addition of two matrices. public class AddMatrix { } public class MultiplyMatrix { } public class Merge { public static void main(String[] args) { } public class LowerTriangle { } |
Beta Was this translation helpful? Give feedback.
-
1. WAP to perform the addition of two matrices.
public class AdditionMatrix {
public static void main(String[] args) {
int[][] m1 = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 } };
int[][] m2 = { { 16, 17, 18, 19, 20 }, { 21, 22, 23, 24, 25 }, { 26, 27, 28, 29, 30 } };
int[][] add = new int[3][5];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 5; j++) {
add[i][j] = m1[i][j] + m2[i][j];
}
}
for (int[] arr : add) {
for (int ele : arr) {
System.out.print(ele + " ");
}
System.out.println();
}
}
}
2. WAP to perform multiplication of two matrices.
public class MultiplicationMatrix {
public static void main(String[] args) {
int[][] m1 = { { 1, 2, 3, 4 }, { 6, 7, 8, 9 }, { 11, 12, 13, 14 } };
int[][] m2 = { { 1, 5, 0, 6 }, { 12, 7, 6, 1 }, { 0, 23, 7, 4 } };
int[][] multi = new int[3][4];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 3; k++) {
multi[i][j] += (m1[i][k] * m2[k][j]);
}
}
}
for (int[] arr : multi) {
for (int ele : arr) {
System.out.print(ele + " ");
}
System.out.println();
}
}
}
3. WAP to print the largest and the smallest elements in an array of numbers
public class SmallLargeArray {
public static void main(String[] args) {
int[] array = { 10, 67, 101, 1, 54, 22 };
int small = array[0];
int large = array[0];
for (int i = 0; i < array.length; i++) {
if (array[i] < small)
small = array[i];
if (array[i] > large)
large = array[i];
}
System.out.println("Largest element:" + large);
System.out.println("Smallest element:" + small);
}
}
4. Given two sorted arrays, merge them into one array which will also be in sorted order.
import java.util.*;
public class MergeArrays {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter length of array 1");
int n1 = sc.nextInt();
int[] a = new int[n1];
System.out.println("Enter elements of array 1");
for (int i = 0; i < n1; i++) {
a[i] = sc.nextInt();
}
System.out.println("Enter length of array 2");
int n2 = sc.nextInt();
int[] b = new int[n2];
System.out.println("Enter elements of array 2");
for (int i = 0; i < n2; i++) {
b[i] = sc.nextInt();
}
int i = 0, j = 0, k = 0;
int[] result = new int[n1 + n2];
while (i < n1 && j < n2) {
if (a[i] < b[j]) {
result[k] = a[i];
i++;
k++;
} else
{result[k] = b[j];
k++;
j++;
}
}
// remaining elements
while (i < n1)
result[k++] = a[i++];
while (j < n2)
result[k++] = b[j++];
for (int ele : result) {
System.out.print(ele + " ");
}
}
}
5. WAP to print the lower triangular matrix.
import java.util.*;
public class LowerTriangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter number rows and columns");
int rows = sc.nextInt();
int cols = sc.nextInt();
int[][] matrix = new int[rows][cols];
System.out.println("Enter elements");
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrix[i][j] = sc.nextInt();
}
}
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
if (j < i)
System.out.print(matrix[i][j] + " ");
}
System.out.println();
}
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
WAP to perform the addition of two matrices.
WAP to perform multiplication of two matrices.
WAP to print the largest and the smallest elements in an array of numbers
Given two sorted arrays, merge them into one array which will also be in sorted order.
WAP to print the lower triangular matrix.
Beta Was this translation helpful? Give feedback.
All reactions