Class Rotatematrix: 17 Dec, 2018 12:25:26 Am
Class Rotatematrix: 17 Dec, 2018 12:25:26 Am
/**
* Write a program to declare a square matrix A[ ][ ] of order MxM where ‘M’
is the number of rows and the number of columns,
* such that M must be greater than 2 and less than 10. 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. Perform the following
tasks:
(a) Display the original matrix.
(b) Rotate the matrix 90° clockwise.
(c) Find the sum of the elements of the four corners of the matrix.
*/
import java.util.*;
class RotateMatrix
{
public static void main(String args[])throws Exception
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the size of the matrix : ");
int m=sc.nextInt();
if(m<3 || m>9)
System.out.println("Size Out Of Range");
else
{
int A[][]=new int[m][m];
System.out.println("*************************");
*/