Wants help in c program made with arrays and function

Joined
Aug 3, 2022
Messages
1
Reaction score
0
#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]*/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top