Home > Back-end >  C language for help
C language for help

Time:05-03

Help to see which wrong

CodePudding user response:

Statement, I just see the main function of the return type is void feel not pleasing to the eye, so reply, ha, ha, ha,
 # include & lt; Stdio. H> 

Int main (void)
{
Int n=1, sum=0;

While (+=n + + (sum) & lt;=3000);

Printf (" % d \ n ", n);
}

CodePudding user response:

Reference:
 # include 

Void main ()
{
Int I=1, sum=0;
While (sum
=3000){
The sum +=I;
i++;
}
Printf (" 1 + 2 + 3 +... + % d=% d \ n ", - I, sum);

}

CodePudding user response:

Variable (I) has not been initialized

CodePudding user response:

refer to the second floor QZJHJXJ response:
for reference:
 # include 

Void main ()
{
Int I=1, sum=0;
While (sum
=3000){
The sum +=I;
i++;
}
Printf (" 1 + 2 + 3 +... + % d=% d \ n ", - I, sum);

}

Why I don't seem quite right after the operation

CodePudding user response:

How do you? Can put the sum & lt;=3000 conditions change smaller, to sum & lt;=10 and see whether correct,

CodePudding user response:

reference 5 floor QZJHJXJ reply:
what is wrong? Can put the sum & lt;=3000 conditions change smaller, to sum & lt;=10 and see whether correct,

Should be yes, I'm no matter how much change he has and the results for the first time I enter data calculated results, may be a little problem

CodePudding user response:

reference 5 floor QZJHJXJ reply:
what is wrong? Can put the sum & lt;=3000 conditions change smaller, to sum & lt;=10 and see whether correct,

Thank you

CodePudding user response:

reference 5 floor QZJHJXJ reply:
what is wrong? Can put the sum & lt;=3000 conditions change smaller, to sum & lt;=10 and see whether correct,

Yes thank you   is your computer problems
  • Related