C program to calculate sum, product of all One Dimensional Array Elements
This program will read N One Dimensional Array Elements, and calculate the Sum and Product of all elements and print the sum and product.
Logic to implement this program - Read array, Run a loop from 0 to N-1 and add each element in SUM variable and multiply each element in PRODUCT variable. Don’t forget to assign 0 in SUM and 1 in PRODUCT variables before running the loop.
Sum and Product of all 1D Array Elements using C program
Output
Using User Define Function
Output
need an explanation for this answer? contact us directly to get an explanation for this answer