Find the Second Largest Element in a 1-D Array Without Sorting in C
This program finds the second largest element in a 1-D array in a single pass, without sorting the array. C Program #include <stdio.h> #include <limits.h> int main() { int arr[100], n, i; int largest = INT_MIN, second = INT_MIN; printf(“Enter number of elements: “); scanf(“%d”, &n); printf(“Enter %d elements:\n”, n); for (i = 0; i … Read more