#include<stdio.h>
#include<string.h>
#define SIZE 100
int main(void)
{
int array[SIZE], i, n, j, sum=0;
printf("Enter some integers:");
for (n=0;n<100;++n)
{
scanf("%d", &array[n]);
if(array[n] == -1)
{
j=n;
break;
}
j=100;
}
for(j<=100;i>j;++i){
printf("%d", array[n]);
}
for(j=0;j<n;++j){
sum=sum+array[n];
printf("The sum is %d\n", sum);
}
return (0);
}
Im trying to output the array on the screen and enter n values, and get them sum between -n to n ONLY. I'm doing something wrong in my for loops, but I cant figure out what. Can I just have some pointers please. Im a complete newbie at this.