Ok I"m new too but hopefully this helps...I found your code kind confusing but maybe with some work we can get it to work. 1st I would pay more attention to your brackets.... you just seem to place them all over randomly. and I would read up on your for loops and if statements so you can make some more clearer code.
If Statements in C - Cprogramming.com Tutorial <---if statements
For, While and Do While Loops in C - Cprogramming.com<---- for loops
Code:
#include<stdio.h>
#include<string.h>
int
main(void)
{
int array[100];
int i;
int max;
int nvalue;
int sum; // this can be changed into int array[100],i,max,nvalue,sum;
/*I'm trying to make system print numbers less than and equal to 100 in an array. When that is done it must ask the user for an imput(n),then
calculate the sum of numbers in the array between –n and n inclusive.*/
printf("Enter some integers here:");
for (i=0; i<100; i++)
{
scanf("%d",&array[i]); // um try moving his after print.... I thnk don't get this forloop
}//missing bracket!!!
if(array[i]==-1) // what kind of test is this if statment? and what is the point of it?
{
max=i;
break;
}
max=100;
//}um random bracket?
for(i=0; i<100; i++)
{
printf("\n%s",array[i]);//um I don't get this for loop ...
//so you want a empty row (/n) and then a string (%s) ???
}
while(nvalue<max) //is it nessary to make a mox = 100? or could you just do nvalue <100
{
nvalue>0;
nvalue<100; // try making your white an if stament that inclues this with a test
scanf("%d");// what are you tryig to scan here?
printf("Please try again");
} //missing bracket!!!
/* Lets calculate the sum*/
for(i=0; i<100; i++)
{//your missing a bracet.... and this for loop is also confusing....
sum=i + nvalue;
printf("The sum is:%d",sum);
}
return(0);
// }why do you have two brackets here?
}