Hello, I need explenation about GCD programm, c++
Hi, can someone give me breakdown of this code, specificly about functions and how they work on this program, also line 36 (int n = sizeof(arr) / sizeof(arr[0]);) why is it important and what does it do.? Ty for your time and sorry for any grammar mistakes :) code: #include <iostream> using namespace std; int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } int findGCD(int arr[], int n) { int result = arr[0]; for (int i = 1; i < n; i++) { result = gcd(arr[i], result); if(result == 1) { return 1; } } return result; } int main() { int number; cin >>number; int arr[number]; for (int i=0;i<number;i++){ cin >> arr[i]; } int n = sizeof(arr) / sizeof(arr[0]); cout << endl; cout << findGCD(arr, n) << endl; if (findGCD(arr, n)%2==1) cout << "Yes"; else cout << "No"; return 0; }