Place N boys and M girls in different rows such that count of persons placed in each row is maximized | C ++ Program to implement the above approach ; Function to calculate GCD of two numbers ; Function to count maximum persons that can be placed in a row ; Driver Code ; Input ; Function to count maximum persons that can be placed in a row
#include <bits/stdc++.h> NEW_LINE using namespace std ; int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } int maximumRowValue ( int n , int m ) { return gcd ( n , m ) ; } int main ( ) { int N = 4 ; int M = 2 ; cout << maximumRowValue ( N , M ) ; }