Can someone please explain how the if block works without using == inside a loop ?
int main(){ int n, m; scanf("%d %d", &n, &m); int *a = malloc(sizeof(int) * n); for(int a_i = 0; a_i < n; a_i++){ scanf("%d",&a[a_i]); } int *b = malloc(sizeof(int) * m); for(int b_i = 0; b_i < m; b_i++){ scanf("%d",&b[b_i]); } int count = 0; for(int x=1; x<=100; x++){ int flag = 1; for(int a_i = 0; a_i < n; a_i++){ for(int b_i = 0; b_i < m; b_i++){ if(x % a[a_i] || b[b_i] % x) flag = 0; } } if(flag) count++; } printf("%d", count); return 0; } Here, can anyone please ...does if loop check x%a[i]==0 and flag==1 ....if yes, why?