Content of a Polynomial | C ++ implementation to find the content of the polynomial ; Function to find the content of the polynomial ; Loop to iterate over the elements of the array ; __gcd ( a , b ) is a inbuilt function for Greatest Common Divisor ; Driver Code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define newl  " NEW_LINE " #define ll  long long NEW_LINE #define pb  push_back NEW_LINE int findContent ( int arr [ ] , int n ) { int content = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { content = __gcd ( content , arr [ i ] ) ; } return content ; } int main ( ) { int n = 3 ; int arr [ ] = { 9 , 6 , 12 } ; cout << findContent ( arr , n ) ; return 0 ; }