Ask your own question, for FREE!
Computer Science 6 Online
OpenStudy (anonymous):

Please Help! How to sum up an array? :( already did this: printf("How many numbers of data (maximum of 10)? "); scanf("%d",&num); for(d=1;d<=num;d++) { printf("Enter data number %d: ",d); scanf("%f",&e[g]); g=g+1; sum=e[0]+e[1]+e[2]+e[3]+e[4]+e[5]+e[6]+e[7]+e[8]+e[9]; } but i failed :( I'm using dev c compiler :D

OpenStudy (konradzuse):

ok. for(d=1;d<=num;d++) { printf("Enter data number %d: ",d); scanf("%f",&e[g]); g=g+1; sum=e[0]+e[1]+e[2]+e[3]+e[4]+e[5]+e[6]+e[7]+e[8]+e[9] when dealing with arrays you will set something = to e[d]? What is the g? Then you do sum += e[g] or sum = sum + e[g] That way your sum is the combined total of the other ojnes until you reach 10

OpenStudy (anonymous):

huh? sorry didn't understand your explanation :( i'm a noob programmer :(

OpenStudy (anonymous):

nvm, already did it.. THANKS! :D

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!