Will mark you brainiest if you help with all of my computer programs.
Computer 10th, [Arrays]
Write a Java program to find and display the following from the given data: int a[] = {17, 20, 24, 29, 16, 87, 19, 52}
i) Display the largest and the smallest element in the array
ii) Product of odd numbers
iii) Sum of even numbers
Answers
Answered by
1
Answer:
Algorithm to find the smallest and largest numbers in an array
Input the array elements.
Initialize small = large = arr[0]
Repeat from i = 2 to n.
if(arr[i] > large)
large = arr[i]
if(arr[i] < small)
small = arr[i]
Print small and large.
Similar questions