diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab2e91d..583c44f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,3 +25,5 @@ ADD YOUR NAME(Github handle) below-: - Paul Ogolla (paulzay) - Akash Singh (thethakursahab) - Harshita Raj (Harshita248) +- Saurabh Kumar(Saurabh70) + diff --git a/LargestSmallest_Number.java b/LargestSmallest_Number.java new file mode 100644 index 0000000..c8dc2ee --- /dev/null +++ b/LargestSmallest_Number.java @@ -0,0 +1,98 @@ +import java.util.Scanner; + +public class assignment1 +{ + public static void main(String args[]) + { + Scanner sc= new Scanner(System.in); + + int r ; + int c; + int i; + int j; + //User Input Matrix + + System.out.println("Enter number of rows:"); + r= sc.nextInt(); + + System.out.println("Enter number of columns:"); + c= sc.nextInt(); + + System.out.println("Enter your elements:"); + int [][] matrix= new int[r][c]; + + for (i=0; i=max) + { + max=matrix[i][j]; + } + + } + System.out.println("Largest element in row"+" "+i+":"+max); + System.out.println("Smallest element in row"+" "+i+":"+min); + + + } + + System.out.println(); //for giving space between output of rows and columns + + //Finding largest and smallest element from the row + for (j=0; j=max1) + { + max1=matrix[i][j]; + } + + } + System.out.println("Largest element in column"+" "+j+":"+max1); + System.out.println("Smallest element in column"+" "+j+":"+min1); + + + } + + + + } + +}