Main.cc: In function 'int main()': Main.cc:24:22: error: 'gcd' was not declared in this scope if (gcd(r[i],r[j])==1) { ^ Main.cc:20:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&r[i]); ^