0

[solved]Can't Understand the question

Please explain how this is working https://www.sololearn.com/post/464916/?ref=app When I tried to Run it : https://code.sololearn.com/c35u4X3C83NZ/?ref=app It shows an error.

13th Jul 2020, 10:05 AM
Akshay Panwar
Akshay Panwar - avatar
9 odpowiedzi
+ 6
a = 0 , b = 0 , c = 0 on every loop a and b will increment by 1 after 7 loop runs now a = 7 b = 7 and c = 0 so the condition a < 7 is false now after 7 more runs a = 14 b = 14 and c = 0 so now b < 14 is false but even after infinite runs the value of c will always remain 0 which will return c < 4 as True and will cause the loop to run forever
13th Jul 2020, 10:55 AM
Rimjhim
Rimjhim - avatar
+ 4
Please Elaborate your question.what you wanna ask?
13th Jul 2020, 10:05 AM
Rimjhim
Rimjhim - avatar
+ 4
that's called comma operator, only the last statement will be executed which is c<4, so until c<4 that's when the execution will stop and in the loop "c" is not incremented that make the loop an infinite loop
13th Jul 2020, 10:25 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 4
Akshay Panwar do you read the warning, it's just trying to tell you that the left hand operands have no effect on how the loop works, which I have stated earlier, it seem the code won't run on sololearn because the compiler have been configure not to run if there is a warning
13th Jul 2020, 4:27 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
you didn't use int main(){ }
13th Jul 2020, 4:17 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
Rimjhim 🌧️ I was copying the link that time . Sorry for that. Now explain me.
13th Jul 2020, 10:06 AM
Akshay Panwar
Akshay Panwar - avatar
0
But ✳AsterisK✳ Rimjhim 🌧️ Can you explain why my code is giving an error to me
13th Jul 2020, 4:16 PM
Akshay Panwar
Akshay Panwar - avatar
0
✳AsterisK✳ is have used it but still showing an error
13th Jul 2020, 4:20 PM
Akshay Panwar
Akshay Panwar - avatar
0
Thank you both
13th Jul 2020, 4:28 PM
Akshay Panwar
Akshay Panwar - avatar