This code is suppose to take up to 10 numbers and multiply them together and give the user the product but what is wrong with it?
This code is suppose to take up to 10 numbers and multiply them together
- and give the user the product but what is wrong with it?9τ
#include <stdio.h>
int main()
{
int array[10], i, n, product=1;
printf(“How many whole numbers do you wish to calculate (up to ten)?: “);
scanf(“%d”, &n);
if (n>10)
{printf(“%d is greater than 10 please run program again”,n); }
if (n<=10)
{
printf(“\nEnter the %d numbers you wish to multiply:\n “,n);
for (i = 1; i <n; i++)
{
scanf(“%d”, &array[i]);
product = product * array[i];
}
printf(“\nThe product of the %d numbers you entered are equal to %d\n”,n, product);
return 0;
}
}