Simple Java GUI Calculator that performs basic mathematical calculations (addition, subtraction, multiplication and divide). In addition, it can calculate the…
Below are links to the solutions to Deitel’s Java How to Program (9th Edition) exercises that have been posted so…
The program below print numbers on the screen using Java. It is the solution to Deitel’s Java How to Program…
The program below computes the product of two 3 by 3 matrices using the Pascal programming language.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
PROGRAM matrix (Input, Output); VAR A, B, C: ARRAY[1..3, 1..3] OF Integer; Arow, AColumn, Brow, BColumn, I, J, K, SUM: Integer; BEGIN Write(' ':4O, 'MATRIX MULTIPLICATION PROGRAM'); Write(' ':4O, '-----------------------------'); Writeln;} Writeln(' Enter the number of ROWS of Matrix A'); Readln(Arow); Writeln(' Enter the number of COLUMNS of Matrix A'); Readln(AColumn); Writeln(' Enter the number of ROWS of Matrix B'); Readln(Brow); Writeln(' Enter the number of COLUMNS of Matrix B'); Readln(BColumn); Writeln(); IF (AColumn = Brow) THEN BEGIN Writeln(' Enter the elements of Matrix A'); For I:= 1 to 3 DO For J:= 1 TO 3 DO Readln(A[I,J]); Writeln(' Enter the elements of Matrix B'); For I:= 1 to 3 DO For J:= 1 TO 3 DO< Readln(B[I,J]); Writeln; { Display the elements of Matrix A } Writeln(' MATRIX A'); Writeln(' --------'); For I:= 1 TO 3 DO BEGIN For J:= 1 TO 3 DO Write(A[I,J]:3); Writeln; END; Writeln; { Display the elements of Matrix B } Writeln(' MATRIX B'); Writeln(' --------'); For I:= 1 TO 3 DO BEGIN For J:= 1 TO 3 DO Write(B[I,J]:3); Writeln; END; Writeln; { Compute the Product of Matrices A and B } For I:= 1 to 3 DO For J:= 1 TO 3 DO BEGIN SUM:=0; For K:= 1 TO 3 DO SUM:= SUM + A[I,K] * B[K,J]; C[I,J]:= SUM; END; Writeln; { Display the Product of Matrices A and B } Writeln(' MATRIX AB'); Writeln(' ---------'); Writeln; For I:= 1 TO 3 DO BEGIN For J:= 1 TO 3 DO Write(C[I,J]:5); Writeln; END; END ELSE Writeln(' Matrix A and B cannot be multiplied. Enter Matrices in the order m x n and n x p'); Writeln(); Writeln(' PRESS THE ENTER KEY TO EXIT'); Readln; END. |
You can modify the…
This is a simple Hello World java program to display the words “Hello World!!!” on the screen.
1 2 3 4 5 6 |
public class HelloWorld { public static void main(String args[]) { System.out.println("Hello World!!!"); } } |