Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
I can't get this code to work, it is supposed to sum, what am I missing?
I can't get this code to work, it is supposed to sum, what am I missing?
#include <stdio.h>
int main()
{
int num[10], i, x, sum = 0, total;
printf("Enter x: ");
scanf("%d", &x);
for(i=0; i>x; ++i)
{
printf("Enter number %d: ",i+1);
scanf("%d", &num[i]);
sum += num[i];
}
total = sum+0;
printf("total = %d", total);
return 0;
}