"Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20." Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20." answered properly. Developers are finding an appropriate answer about Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20. related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20.. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20..
Given a square matrix list[ ] [ ] of order 'n'. The maximum value possible for 'n' is 20.
import java.util.*;
class ISCprac2008q03{
public static void main(String args[])
throws InputMismatchException{
Scanner scan=new Scanner(System.in);
System.out.println("Enter the number of rows(<=20) for the square matrix : ");
int n=scan.nextInt();
if(n>20)
System.out.println("Number must not exceed 20.");
else{
int a[][]=new int[n][n];
int i,j,rg,cg,rs,cs,s,g,k,t;
for(i=0;i< n;i++){
for(j=0;j< n;j++){
a[i][j] = scan.nextInt();
}
}
System.out.println("ORIGINAL MATRIX: ");
for(i=0;i< n;i++){
for(j=0;j< n;j++){
System.out.print(a[i][j] + " ");
}
System.out.println();
}
s = g = a[0][0];
rg=cg=rs=cs=0;
for(i=0;i< n;i++){
for(j=0;j< n;j++){
//Condition to check smallest element
if(s > a[i][j]){
s = a[i][j];
rs = i;
cs = j;
}
//Condition to check greatest element
if(g < a[i][j]){
g = a[i][j];
rg = i;
cg = j;
}
}
}
for(i=0;i< n;i++){
for(j=0;j< n;j++){
for(k=j+1;k< n;k++){
if(a[i][j] > a[i][k]){
t = a[i][j];
a[i][j] = a[i][k];
a[i][k] = t;
}
}
}
}
System.out.println("The largest element "+g+" is in row "+(rg+1)+" and column "+(cg+1));
System.out.println("The smallest element "+s+" is in row "+(rs+1)+" and column "+(cs+1));
System.out.println("SORTED MATRIX: ");
for(i=0;i< n;i++){
for(j=0;j< n;j++){
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}//else
}//eom
}//eoc
Source: www.wethementors.com
All those coders who are working on the Whatever based application and are stuck on Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20. can get a collection of related answers to their query. Programmers need to enter their query on Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20. related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20. for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20. while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20.". Visit this developer's friendly online web community, CodeProZone, and get your queries like Given a square matrix list of order 'n'. The maximum value possible for 'n' is 20. resolved professionally and stay updated to the latest Whatever updates.