Создать числовой массив A[1..N]. Вычислить произведение всех элементов, значения которых лежат в интервале [1,10]. Выдать на экран количество этих элементов и их произведение.Язык СИ
#include <stdio.h> int main() { int N; printf("Enter the size of the array: "); scanf("%d", &N); int A[N]; int i; int count = 0; long long product = 1; for (i = 0; i < N; i++) { printf("Enter element A[%d]: ", i+1); scanf("%d", &A[i]); if (A[i] >= 1 && A[i] <= 10) { count++; product *= A[i]; } } printf("Number of elements in the range [1,10]: %d\n", count); printf("Product of elements in the range [1,10]: %lld\n", product); return 0; }
int main() {
int N;
printf("Enter the size of the array: ");
scanf("%d", &N);
int A[N];
int i;
int count = 0;
long long product = 1;
for (i = 0; i < N; i++) {
printf("Enter element A[%d]: ", i+1);
scanf("%d", &A[i]);
if (A[i] >= 1 && A[i] <= 10) {
count++;
product *= A[i];
}
}
printf("Number of elements in the range [1,10]: %d\n", count);
printf("Product of elements in the range [1,10]: %lld\n", product);
return 0;
}