Computer Science, asked by ishaanrick31, 15 hours ago

Write a program to input 10 numbers into an array interchange the largest number with the smallest number within the array and print the modified array. Assume that there is only one largest and smallest number. Sample Input: a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9] 4 17 88 6 25 76 2 77 65 14

Answers

Answered by anweshkarmakar2004
1

Answer:

Given an array of integers, task is to print the array in the order – smallest number, Largest number, 2nd smallest number, 2nd largest number, 3rd smallest number, 3rd largest number and so on…..

Examples: 

 

Input : arr[] = [5, 8, 1, 4, 2, 9, 3, 7, 6] Output :arr[] = {1, 9, 2, 8, 3, 7, 4, 6, 5} Input : arr[] = [1, 2, 3, 4] Output :arr[] = {1, 4, 2, 3}

Similar questions