+ 3
My Challenge Question: What was the value of variable at the beginning?
Instead of ??? try to find out the start positive integer value of variable n in the code below, which outputs 247: int main(void) { unsigned int n=???, sum=0; for (unsigned int i=0; i<???; i++) { n+=2; sum+=n; } cout << sum; //outputs 247 return 0; } Please, explain your answer and notice if this question is difficult.
11 Respuestas
+ 4
your question is too easy if it was meant to be like this...
https://code.sololearn.com/coLGfAm8PP1H/?ref=app
else add some more ingredients to make it harder!
+ 3
hoooooo hoooooo
I won against you Sir !
ho hoo
+ 3
Yes. Congratulations!😊 And what about this question?
+ 2
Instead of ??? must be integers. Starting value of n and exit value in loop for i could be different.
+ 2
n=245 and i<1 is one of solutions. Sorry, I forgot to notice, that there is more than one iteration in this loop. Another solution is more interesting.
+ 2
really sorry sir
I dont know much about C++ and C# !!
+ 1
No, not 6.
+ 1
Well... n=245 ... i<1 xD
0
n=n
0
is that 6?
0
is the limit of i the same value of n?