SlideShare a Scribd company logo
1 of 2
Download to read offline
MinOfFourNumbers.java
import java.util.Scanner;
public class MinOfFourNumbers {
public static void main(String[] args) {
//Creating an Integer array of size 4
int numbers[]=new int[4];
//declaring the variables
int min;
//Scanner object is used to get the values entered by the user.
Scanner sc=new Scanner(System.in);
/* This for loop will get the values from the user
* and populate into the array
*/
for(int i=0;i<4;i++)
{
//Getting the number from the user.
System.out.print("Enter Number "+(i+1)+" :");
numbers[i]=sc.nextInt();
}
//Store the first element of the array in min variable
min=numbers[0];
//This loop will calculate the minimum of 4 numbers
for(int i=0;i<4;i++)
{
/*Check each element of the array with the value value contained in the min variable.
* If the element of the array is less than min,then assign that element to min variable
*/
if(numbers[i]
Solution
MinOfFourNumbers.java
import java.util.Scanner;
public class MinOfFourNumbers {
public static void main(String[] args) {
//Creating an Integer array of size 4
int numbers[]=new int[4];
//declaring the variables
int min;
//Scanner object is used to get the values entered by the user.
Scanner sc=new Scanner(System.in);
/* This for loop will get the values from the user
* and populate into the array
*/
for(int i=0;i<4;i++)
{
//Getting the number from the user.
System.out.print("Enter Number "+(i+1)+" :");
numbers[i]=sc.nextInt();
}
//Store the first element of the array in min variable
min=numbers[0];
//This loop will calculate the minimum of 4 numbers
for(int i=0;i<4;i++)
{
/*Check each element of the array with the value value contained in the min variable.
* If the element of the array is less than min,then assign that element to min variable
*/
if(numbers[i]

More Related Content

Similar to MinOfFourNumbers.javaimport java.util.Scanner;public class MinOf.pdf

import java.util.Scanner;public class ArrayData {      AR.pdf
import java.util.Scanner;public class ArrayData {        AR.pdfimport java.util.Scanner;public class ArrayData {        AR.pdf
import java.util.Scanner;public class ArrayData {      AR.pdf
info382133
 
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfGetting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
info309708
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
akkhan101
 
The java program Jumble that prompts user to enter nu.pdf
   The java program Jumble that prompts user to  enter nu.pdf   The java program Jumble that prompts user to  enter nu.pdf
The java program Jumble that prompts user to enter nu.pdf
annapurnnatextailes
 
when I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docxwhen I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docx
lashandaotley
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
Aiman Hud
 
Implementation of Banker’s Algorithm using java is given below .pdf
Implementation of Banker’s Algorithm using java is given below .pdfImplementation of Banker’s Algorithm using java is given below .pdf
Implementation of Banker’s Algorithm using java is given below .pdf
aryan9007
 
Write a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdfWrite a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdf
fashioncollection2
 
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdfLab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
QalandarBux2
 
Write a function which return a list of all of the n element subset .pdf
Write a function which return a list of all of the n element subset .pdfWrite a function which return a list of all of the n element subset .pdf
Write a function which return a list of all of the n element subset .pdf
hardjasonoco14599
 
using recursive method .pdf
  using recursive method .pdf  using recursive method .pdf
using recursive method .pdf
vichu19891
 
Complete the classes shown below 1. The MinHeap Class Write necessa.pdf
Complete the classes shown below 1. The MinHeap Class Write necessa.pdfComplete the classes shown below 1. The MinHeap Class Write necessa.pdf
Complete the classes shown below 1. The MinHeap Class Write necessa.pdf
americanopticalscbe
 

Similar to MinOfFourNumbers.javaimport java.util.Scanner;public class MinOf.pdf (20)

Sorting and Searching in Array.pptx
Sorting and Searching in Array.pptxSorting and Searching in Array.pptx
Sorting and Searching in Array.pptx
 
import java.util.Scanner;public class ArrayData {      AR.pdf
import java.util.Scanner;public class ArrayData {        AR.pdfimport java.util.Scanner;public class ArrayData {        AR.pdf
import java.util.Scanner;public class ArrayData {      AR.pdf
 
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfGetting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
The java program Jumble that prompts user to enter nu.pdf
   The java program Jumble that prompts user to  enter nu.pdf   The java program Jumble that prompts user to  enter nu.pdf
The java program Jumble that prompts user to enter nu.pdf
 
when I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docxwhen I compile to get the survey title the overload constructor asks.docx
when I compile to get the survey title the overload constructor asks.docx
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
 
6_Array.pptx
6_Array.pptx6_Array.pptx
6_Array.pptx
 
Implementation of Banker’s Algorithm using java is given below .pdf
Implementation of Banker’s Algorithm using java is given below .pdfImplementation of Banker’s Algorithm using java is given below .pdf
Implementation of Banker’s Algorithm using java is given below .pdf
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdfC++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
 
Write a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdfWrite a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdf
 
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdfLab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
 
Write a function which return a list of all of the n element subset .pdf
Write a function which return a list of all of the n element subset .pdfWrite a function which return a list of all of the n element subset .pdf
Write a function which return a list of all of the n element subset .pdf
 
Java programs
Java programsJava programs
Java programs
 
Dr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive inputDr. Rajeshree Khande - Java Interactive input
Dr. Rajeshree Khande - Java Interactive input
 
Dr. Rajeshree Khande Java Interactive input
Dr. Rajeshree Khande Java Interactive inputDr. Rajeshree Khande Java Interactive input
Dr. Rajeshree Khande Java Interactive input
 
using recursive method .pdf
  using recursive method .pdf  using recursive method .pdf
using recursive method .pdf
 
Hw3
Hw3Hw3
Hw3
 
What will be the output from the following code if the user enters 4.pdf
What will be the output from the following code if the user enters 4.pdfWhat will be the output from the following code if the user enters 4.pdf
What will be the output from the following code if the user enters 4.pdf
 
Complete the classes shown below 1. The MinHeap Class Write necessa.pdf
Complete the classes shown below 1. The MinHeap Class Write necessa.pdfComplete the classes shown below 1. The MinHeap Class Write necessa.pdf
Complete the classes shown below 1. The MinHeap Class Write necessa.pdf
 

More from aptex1

Answer i command.The vi editor always starts in command mode. For.pdf
Answer i command.The vi editor always starts in command mode. For.pdfAnswer i command.The vi editor always starts in command mode. For.pdf
Answer i command.The vi editor always starts in command mode. For.pdf
aptex1
 
2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf
2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf
2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf
aptex1
 
1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf
1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf
1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf
aptex1
 
1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf
1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf
1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf
aptex1
 
Thermodynamic entropy is a non-conserved state fu.pdf
                     Thermodynamic entropy is a non-conserved state fu.pdf                     Thermodynamic entropy is a non-conserved state fu.pdf
Thermodynamic entropy is a non-conserved state fu.pdf
aptex1
 

More from aptex1 (20)

Name- Gold leaved white PoplarGenus- Populusspecies- albaAutho.pdf
Name- Gold leaved white PoplarGenus- Populusspecies- albaAutho.pdfName- Gold leaved white PoplarGenus- Populusspecies- albaAutho.pdf
Name- Gold leaved white PoplarGenus- Populusspecies- albaAutho.pdf
 
molarity = 0.252101.1 =0.001236 M percent =0.251002 =12.5 .pdf
molarity = 0.252101.1 =0.001236 M percent =0.251002 =12.5 .pdfmolarity = 0.252101.1 =0.001236 M percent =0.251002 =12.5 .pdf
molarity = 0.252101.1 =0.001236 M percent =0.251002 =12.5 .pdf
 
Initial concentration of Br- = 2.25 x 10e-3M1V1=M2V2therefore M2.pdf
Initial concentration of Br- = 2.25 x 10e-3M1V1=M2V2therefore M2.pdfInitial concentration of Br- = 2.25 x 10e-3M1V1=M2V2therefore M2.pdf
Initial concentration of Br- = 2.25 x 10e-3M1V1=M2V2therefore M2.pdf
 
import java.util.Scanner;public class HornersPolynomial {   .pdf
import java.util.Scanner;public class HornersPolynomial {   .pdfimport java.util.Scanner;public class HornersPolynomial {   .pdf
import java.util.Scanner;public class HornersPolynomial {   .pdf
 
Direct memory access (DMA) is a function that allows an inputoutput.pdf
Direct memory access (DMA) is a function that allows an inputoutput.pdfDirect memory access (DMA) is a function that allows an inputoutput.pdf
Direct memory access (DMA) is a function that allows an inputoutput.pdf
 
Ethanol is miscible in water because of the hydroxyl functional grou.pdf
Ethanol is miscible in water because of the hydroxyl functional grou.pdfEthanol is miscible in water because of the hydroxyl functional grou.pdf
Ethanol is miscible in water because of the hydroxyl functional grou.pdf
 
the diluted concentration of HCl = (0.120 M x 25..pdf
                     the diluted concentration of HCl = (0.120 M x 25..pdf                     the diluted concentration of HCl = (0.120 M x 25..pdf
the diluted concentration of HCl = (0.120 M x 25..pdf
 
Simple Nobody Knows The Answer .pdf
                     Simple Nobody Knows The Answer                   .pdf                     Simple Nobody Knows The Answer                   .pdf
Simple Nobody Knows The Answer .pdf
 
AnswerThe net equation of the reaction catalyzed by the protein c.pdf
AnswerThe net equation of the reaction catalyzed by the protein c.pdfAnswerThe net equation of the reaction catalyzed by the protein c.pdf
AnswerThe net equation of the reaction catalyzed by the protein c.pdf
 
Answer i command.The vi editor always starts in command mode. For.pdf
Answer i command.The vi editor always starts in command mode. For.pdfAnswer i command.The vi editor always starts in command mode. For.pdf
Answer i command.The vi editor always starts in command mode. For.pdf
 
Answer (b) systems security and control.The businesses are now a .pdf
Answer (b) systems security and control.The businesses are now a .pdfAnswer (b) systems security and control.The businesses are now a .pdf
Answer (b) systems security and control.The businesses are now a .pdf
 
A. Temeperature of refrigeratorsIntervalB. Horspower of .pdf
A. Temeperature of refrigeratorsIntervalB. Horspower of .pdfA. Temeperature of refrigeratorsIntervalB. Horspower of .pdf
A. Temeperature of refrigeratorsIntervalB. Horspower of .pdf
 
48. The answer is Botulism. Botulism ia an illness that brings about.pdf
48. The answer is Botulism. Botulism ia an illness that brings about.pdf48. The answer is Botulism. Botulism ia an illness that brings about.pdf
48. The answer is Botulism. Botulism ia an illness that brings about.pdf
 
2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf
2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf
2) b) Understory is rich in humidity hence supports fungi3) a) can.pdf
 
1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf
1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf
1.Discuss in detail Emile Durkheim and his contributions to the fiel.pdf
 
1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf
1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf
1) YELLOW FEVERGroup Group IV ((+) ssRNA)Order   Unassigned.pdf
 
Thermodynamic entropy is a non-conserved state fu.pdf
                     Thermodynamic entropy is a non-conserved state fu.pdf                     Thermodynamic entropy is a non-conserved state fu.pdf
Thermodynamic entropy is a non-conserved state fu.pdf
 
I is oxidized by 6 electrons as the oxidation sta.pdf
                     I is oxidized by 6 electrons as the oxidation sta.pdf                     I is oxidized by 6 electrons as the oxidation sta.pdf
I is oxidized by 6 electrons as the oxidation sta.pdf
 
The main difference is that Democritus was not a .pdf
                     The main difference is that Democritus was not a .pdf                     The main difference is that Democritus was not a .pdf
The main difference is that Democritus was not a .pdf
 
for acidic nature is should give H+ equation H.pdf
                     for acidic nature is should give H+  equation  H.pdf                     for acidic nature is should give H+  equation  H.pdf
for acidic nature is should give H+ equation H.pdf
 

Recently uploaded

Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 

MinOfFourNumbers.javaimport java.util.Scanner;public class MinOf.pdf

  • 1. MinOfFourNumbers.java import java.util.Scanner; public class MinOfFourNumbers { public static void main(String[] args) { //Creating an Integer array of size 4 int numbers[]=new int[4]; //declaring the variables int min; //Scanner object is used to get the values entered by the user. Scanner sc=new Scanner(System.in); /* This for loop will get the values from the user * and populate into the array */ for(int i=0;i<4;i++) { //Getting the number from the user. System.out.print("Enter Number "+(i+1)+" :"); numbers[i]=sc.nextInt(); } //Store the first element of the array in min variable min=numbers[0]; //This loop will calculate the minimum of 4 numbers for(int i=0;i<4;i++) { /*Check each element of the array with the value value contained in the min variable. * If the element of the array is less than min,then assign that element to min variable */ if(numbers[i] Solution
  • 2. MinOfFourNumbers.java import java.util.Scanner; public class MinOfFourNumbers { public static void main(String[] args) { //Creating an Integer array of size 4 int numbers[]=new int[4]; //declaring the variables int min; //Scanner object is used to get the values entered by the user. Scanner sc=new Scanner(System.in); /* This for loop will get the values from the user * and populate into the array */ for(int i=0;i<4;i++) { //Getting the number from the user. System.out.print("Enter Number "+(i+1)+" :"); numbers[i]=sc.nextInt(); } //Store the first element of the array in min variable min=numbers[0]; //This loop will calculate the minimum of 4 numbers for(int i=0;i<4;i++) { /*Check each element of the array with the value value contained in the min variable. * If the element of the array is less than min,then assign that element to min variable */ if(numbers[i]