Program to find the largest two numbers from n elements in an array and then calculate and display their average
Answers
Answered by
0
Explanation:
Java program
1. Step 2: (int max
a[0];)
2. Step 3: (for int i
1; i < a.length; i++
3. Step 4: if(ali]
max)
4. Use if condition to compare array current value with
max value, if current array value is greater than max
then assign array current value as max (max ali];)
5. Program
6. Output
Answered by
3
hello!
____
This is a C Program to calculate the largest two numbers in a given Array.
We have to write a program in C such that the program will read the elements of a one-dimensional array.
then compares the elements and finds which are the largest two elements in a given array.
Similar questions