Page 327 - computer science (868) class 11
P. 327
23. Write a program in Java to enter the natural numbers in a double-dimensional array m × n (where m is the number of rows and n
is the number of columns). Display the new matrix in such a way that the new matrix is the mirror image of the original matrix.
For example:
Sample Input:
8 15 9 18
9 10 7 6
10 8 11 13
12 16 17 19
Sample Output:
18 9 15 8
6 7 10 9
13 11 8 10
19 17 16 12
24. Write a Java program to input two matrices and find the subtraction of their elements in the third matrix. The condition for
finding the subtraction of two matrices in Java is that both the matrices should have the same size.
25. Write a Java program to input elements in an array of size 4 × 3 and print the numbers that are:
a. sum of all the odd numbers in odd positions; and
b. print all the non-boundary elements.
26. Write a program in Java to accept the names and marks in Computer Science of forty students in two single-dimensional arrays
and then print the names and marks of students according to their merit.
27. Write a program in Java to store the elements in two different matrices A and B of order 4 × 4. Find the product of two matrices
and store the result in another matrix C.
3 2 1 2 -2 -4 -1 0 5 -1 -5 20
6 4 5 0 3 6 -5 2 25 15 -6 38
x =
7 -1 0 2 5 3 4 6 -17 -38 2 -8
4 3 1 1 0 -2 -2 5 6 3 -13 17
A matrix B Matrix C(resultant) Matrix
28. A bank intends to design a program to display the denomination of an input amount up to 5 digits. The available denomination
with the bank are of rupees 500, 200, 100, 50, 20, 10 and 1.
Design a program in Java to accept the amount from the user and display the break-up in descending order of denominations
(i.e., preference should be given to the highest denomination available) along with the total number of notes.
[Note: Only the denomination used should be displayed].
Also, print the amount in words according to the digits.
Example 1:
Input:
14836
Output:
One Four Eight Three Six
Denomination:
500 * 29 = 14500
200 * 1 = 200
100 * 1 = 100
20 * 1 = 20
10 * 1 = 10
1 * 6 = 6
Example 2:
Input:
235001
Output:
Invalid Amount
325
Arrays 325

