Find the ratio of number of elements in two Arrays from their individual and combined average | C ++ program to Find the Ratio of number of Elements in two Arrays from their individual and combined Average ; C ++ function to find the ratio of number of array elements ; calculating GCD of them ; make neumarator and denominator coprime ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void FindRatio ( int a , int b , int c ) { int up = abs ( b - c ) ; int down = abs ( c - a ) ; int g = __gcd ( up , down ) ; up /= g ; down /= g ; cout << up << " : " << down << " STRNEWLINE " ; } int main ( ) { int a = 4 , b = 10 , c = 6 ; FindRatio ( a , b , c ) ; return 0 ; }