Maximum value of division of two numbers in an Array | CPP program to maximum value of division of two numbers in an array ; Function to maximum value of division of two numbers in an array ; Traverse through the array ; Return the required answer ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int Division ( int a [ ] , int n ) { int maxi = INT_MIN , mini = INT_MAX ; for ( int i = 0 ; i < n ; i ++ ) { maxi = max ( a [ i ] , maxi ) ; mini = min ( a [ i ] , mini ) ; } return maxi / mini ; } int main ( ) { int a [ ] = { 3 , 7 , 9 , 3 , 11 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << Division ( a , n ) ; return 0 ; }