My issue
I am facing run time error. I run my code on vscode and it gives the right outpute
My code
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
// Function to find gcd of array of
// numbers
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() {
// your code goes here
}
Learning course: Number theory
Problem Link: Luigi and Uniformity Practice Problem in Number theory - CodeChef