SlideShare une entreprise Scribd logo
1  sur  3
In JAVA!
Write the program that will do the following tasks:
Declare a 5 X 8 integer array
Using nested for loops prompt and ask the user to enter all 40 values in the array.
3. Output the largest value in the array
4. Output the smallest number in the array
Solution
import java.io.*;
import java.util.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class test7
{
public static void main(String args[])
{
int row, col, i, j;
int arr[][] = new int[5][8];
Scanner scan = new Scanner(System.in);
System.out.print("Enter Number of Row for Array (max 10) : ");
row = scan.nextInt();
System.out.print("Enter Number of Column for Array (max 10) : ");
col = scan.nextInt();
System.out.print("Enter " +(row*col)+ " Array Elements : ");
for(i=0; i<row; i++)
{
for(j=0; j<col; j++)
{
arr[i][j] = scan.nextInt();
}
}
System.out.print("The Array is : ");
for(i=0; i<row; i++)
{
for(j=0; j<col; j++)
{
System.out.print(arr[i][j]+ " ");
}
System.out.println();
}
int h = Â Â 0;// highest value dependency
int l= Â Â 0;// lowest value dependency
for ( i = 0; i < row; i++){ //find highest value
for (j = 0; j <col; j++){
if (arr[i][j] < l){
l = arr[i][j];
}
}
}
for ( i = 0; i < row; i++){ //find lowest value
for (j = 0; j <col; j++){
if (arr[i][j] >h){
h= arr[i][j];
}
}
}
System.out.println(l);//print highest
System.out.println(h);//print lowest
}
}
In JAVA!  Write the program that will do the following tasks- Declare.docx

Contenu connexe

Similaire à In JAVA! Write the program that will do the following tasks- Declare.docx

CODEimport java.util.; public class test { public static voi.pdf
CODEimport java.util.; public class test { public static voi.pdfCODEimport java.util.; public class test { public static voi.pdf
CODEimport java.util.; public class test { public static voi.pdfanurag1231
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
Anjalisoorej imca133 assignment
Anjalisoorej imca133 assignmentAnjalisoorej imca133 assignment
Anjalisoorej imca133 assignmentAnjaliSoorej
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptxKimVeeL
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfrajeshjangid1865
 
CountStringCharacters.javaimport java.util.Scanner; public cla.pdf
CountStringCharacters.javaimport java.util.Scanner; public cla.pdfCountStringCharacters.javaimport java.util.Scanner; public cla.pdf
CountStringCharacters.javaimport java.util.Scanner; public cla.pdfpremsrivastva8
 
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdfFactors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdfdeepakangel
 
Please help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfPlease help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfaioils
 

Similaire à In JAVA! Write the program that will do the following tasks- Declare.docx (14)

Java file
Java fileJava file
Java file
 
CODEimport java.util.; public class test { public static voi.pdf
CODEimport java.util.; public class test { public static voi.pdfCODEimport java.util.; public class test { public static voi.pdf
CODEimport java.util.; public class test { public static voi.pdf
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Java final lab
Java final labJava final lab
Java final lab
 
Anjalisoorej imca133 assignment
Anjalisoorej imca133 assignmentAnjalisoorej imca133 assignment
Anjalisoorej imca133 assignment
 
3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf3.Lesson Plan - Input.pdf.pdf
3.Lesson Plan - Input.pdf.pdf
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptx
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
 
CountStringCharacters.javaimport java.util.Scanner; public cla.pdf
CountStringCharacters.javaimport java.util.Scanner; public cla.pdfCountStringCharacters.javaimport java.util.Scanner; public cla.pdf
CountStringCharacters.javaimport java.util.Scanner; public cla.pdf
 
Java programs
Java programsJava programs
Java programs
 
Java programs
Java programsJava programs
Java programs
 
Oot practical
Oot practicalOot practical
Oot practical
 
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdfFactors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
 
Please help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfPlease help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdf
 

Plus de carold12

In scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docxIn scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docxcarold12
 
In managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docxIn managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docxcarold12
 
in Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docxin Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docxcarold12
 
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docxIn Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docxcarold12
 
In Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docxIn Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docxcarold12
 
In its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docxIn its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docxcarold12
 
in thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docxin thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docxcarold12
 
In the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docxIn the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docxcarold12
 
In this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docxIn this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docxcarold12
 
In the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docxIn the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docxcarold12
 
In the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docxIn the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docxcarold12
 
3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docx3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docxcarold12
 
3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docx3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docxcarold12
 
2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docx2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docxcarold12
 
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docxcarold12
 
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docxcarold12
 
25- Question Part Points Submissions Used 1.docx
25-       Question Part   Points   Submissions Used         1.docx25-       Question Part   Points   Submissions Used         1.docx
25- Question Part Points Submissions Used 1.docxcarold12
 
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docxcarold12
 

Plus de carold12 (18)

In scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docxIn scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docx
 
In managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docxIn managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docx
 
in Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docxin Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docx
 
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docxIn Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
 
In Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docxIn Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docx
 
In its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docxIn its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docx
 
in thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docxin thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docx
 
In the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docxIn the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docx
 
In this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docxIn this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docx
 
In the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docxIn the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docx
 
In the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docxIn the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docx
 
3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docx3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docx
 
3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docx3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docx
 
2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docx2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docx
 
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
 
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
 
25- Question Part Points Submissions Used 1.docx
25-       Question Part   Points   Submissions Used         1.docx25-       Question Part   Points   Submissions Used         1.docx
25- Question Part Points Submissions Used 1.docx
 
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
 

Dernier

GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 

Dernier (20)

GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 

In JAVA! Write the program that will do the following tasks- Declare.docx

  • 1. In JAVA! Write the program that will do the following tasks: Declare a 5 X 8 integer array Using nested for loops prompt and ask the user to enter all 40 values in the array. 3. Output the largest value in the array 4. Output the smallest number in the array Solution import java.io.*; import java.util.*; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class test7 { public static void main(String args[]) { int row, col, i, j; int arr[][] = new int[5][8]; Scanner scan = new Scanner(System.in); System.out.print("Enter Number of Row for Array (max 10) : "); row = scan.nextInt(); System.out.print("Enter Number of Column for Array (max 10) : "); col = scan.nextInt(); System.out.print("Enter " +(row*col)+ " Array Elements : "); for(i=0; i<row; i++)
  • 2. { for(j=0; j<col; j++) { arr[i][j] = scan.nextInt(); } } System.out.print("The Array is : "); for(i=0; i<row; i++) { for(j=0; j<col; j++) { System.out.print(arr[i][j]+ " "); } System.out.println(); } int h = Â Â 0;// highest value dependency int l= Â Â 0;// lowest value dependency for ( i = 0; i < row; i++){ //find highest value for (j = 0; j <col; j++){ if (arr[i][j] < l){ l = arr[i][j]; } } } for ( i = 0; i < row; i++){ //find lowest value for (j = 0; j <col; j++){ if (arr[i][j] >h){ h= arr[i][j]; } } } System.out.println(l);//print highest System.out.println(h);//print lowest } }