HCF problem hackerblocks


3 test cases are wrong,please help.

Hey Dhruv ! Can you post the Qn. link as well ??

https://online.codingblocks.com/player/2584/content/787

The Qn. link is not working for me , post the question

Given N positive numbers, your task is to calculate their HCF.

if question is to find gcd of all elements of array then you are doing this wrong , you should do hcf=gcd(a[i],hcf);
for(int i=0;i<n-1;i++){
hcf=gcd(a[i],a[i+1]);

}
1 Like