Math, asked by luckygluckyg666, 9 months ago

which set we cannot find the largest and smallest number​

Answers

Answered by ravikholi81828
1

Answer:

package org.arpit.java2blog;

/*

Java program to Find Largest and Smallest Number in an Array

*/

public class FindLargestSmallestNumberMain {

public static void main(String[] args) {

//array of 10 numbers

int arr[] = new int[]{12,56,76,89,100,343,21,234};

//assign first element of an array to largest and smallest

int smallest = arr[0];

int largest = arr[0];

for(int i=1; i< arr.length; i++)

{

if(arr[i] > largest)

largest = arr[i];

else if (arr[i] < smallest)

smallest = arr[i];

}

System.out.println("Smallest Number is : " + smallest);

System.out.println("Largest Number is : " + largest);

}

}

When you run above program, you will get below output:

1

2

3

4

Largest Number is : 343

Smallest Number is : 12

Step-by-step explanation:

Make me brainliest

Answered by eshalfma
0

Answer

157

Step-by-step explanation:

1

5

7

Similar questions