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
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
huh? sorry didn't understand your explanation :( i'm a noob programmer :(
nvm, already did it.. THANKS! :D
Join our real-time social learning platform and learn together with your friends!