• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

wants help in a c program made by use of arrays and function

Nk301lll

New Coder
#include <stdio.h>

double calculateSum(double age[]) {

double sum = 0.0;

for (int i = 0; i < 7; ++i) {
sum += age;
}
return sum;//wants return sum from this function
}

int main() {
double result, age[7];
printf("Enter seven numbers: ");
for(int i=0;i<7;++i)
{
scanf("%lf ", age);//wants elements of age[7] array from user
}

result = calculateSum(age);
printf("Result = %.2lf", result); //wants to print result

return 0;
}/*run hone ke baad fault aa rha hai
showing ->
proot info: vpid 1: terminated with signal 11

[Process completed (code 255) - press Enter]*/
 
Top