What will be the result of following loop execution?
using namespace std;

int main(){
    int sum = 0;
    for(int i = 0; i<5; i++) sum += i,
    sum = 1;
    return 0;
Since the "comma" operator has been used, few lines will be executed in the loop.

Hi @Samurai I have checked https://ideone.com/SHVmHo and the correct answer still 02345

2019 Nov 18, 8:01:09 PM

there are no correct answer. according to this code result will be "12222"

2019 Oct 28, 7:24:47 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes