Hello!
I need from help for this program:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int N;
int a;
int mas[100];
int rem;
int product=1;
printf("Enter numbers: ");
scanf("%d", &N);
if (N <= 100)
{
for (a = 0; a < N; a++)
{
printf("Enter number: ");
scanf("%d", &mas[a]);
}
for (a = 0; a < N; a++)
{
printf("The numbers are: %d,\t", mas[a]);
}
for (a = 0; a < N; a++)
{
if (mas[a] != 0)
{
rem = a % 10;
product = product * rem;
a = a / 10;
}
printf("%d", mas[a]);
}
}
return 0;
}
How to find the element of the array that has the largest product of its digits? This is the part of the code that has a problem, but I don't know what it is:
Code:
for (a = 0; a < N; a++) {
if (mas[a] != 0)
{
rem = a % 10;
product = product * rem;
a = a / 10;
}
printf("%d", mas[a]);
}