It is required to write a program that displays the product of two-digit numbers in an array that are not a multiple of seven. I wrote on the following
#include <stdio.h> #define N 5 void main(void) { long A[N]; long j, i, p; for (i = 0; i < N; i++) { scanf("%ld", &A[i]); } p = 1; for (i = 0; i < N; i++) { if (A[i] >= 10 && A[i] <= 99 && A[i] % 7 != 0) { j = A[i]; p = p * j; } } printf("%ld", p); }
But this only displays the last element of the array. Help catch the error.