Computer Project Term 2 XI
Computer Project Term 2 XI
Ex:
Ex:
Ex:
Ex:
Input: 131
Input: 123
Input: 1193
Ex:
Test your program for the following data and some random data:
Example 1
INPUT: Pack my box with five dozen liquor jugs.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: dozen
SHORTEST WORD: my
Example 2
INPUT: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: QUICK
SHORTEST WORD: THE
Example3
INPUT: Hello my World.
OUTPUT: IT IS NOT A PANGRAM
LONGEST WORD: Hello
SHORTEST WORD: my
Example4
INPUT: Alas ! it failed #
OUTPUT: INVALID INPUT
of rows and the number of columns, such that M must be greater than 2 and less than I0.
Accept the value of M as user input. Display an appropriate message for an invalid input.
Allow the user to input integers into this matrix. Perfonn the following tasks:
(a) Display the original matrix.
(b) Check if the given matrix is Symmetric or not.
A square matrix is said to be Symmetric, if the element of the i'11 row and j 111 column
is equal to the element of the j'h row and i111 column.
(c) Find the sum of the elements of left diagonal and the sum of the elements of right
diagonal of the matrix and display them.
Test your program for the following data and some random data:
Example I
INPUT: M=3
Enter elements of the matrix:
I 2 3
2 4 5
3 5 6
OUTPUT: ORIGINAL MATRIX
I 2 3
2 4 5
3 5 6
THE GIVEN MATRIX IS SYMMETRIC
The sum of the left diagonal = 11
The sum of the right diagonal = I0
Example 2
INPUT: M=4
Enter elements of the matrix:
7 8 9 2
4 5 6 3
8 5 3 I
7 6 4 2
OUTPUT: ORIGINAL MATRIX
7 8 9 2
4 5 6 3
8 5 3 I
7 6 4 2
THE GIVEN MA TRIX IS NOT SYMMETRIC
The sum of the left diagonal = 17
The sum of the right diagonal = 20
ExampleJ
INPUT: M= 12
OUTPUT: SIZE IS OUT OF RANGE