Which choice does not produce the same output as this code snippet? Assume the variable i will not be used anywhere else in the code.

Advertisement

for (i=1;i<10;i++){
cout<<i<<endl;
}

  • A
    i=1;
    while(i<10){
    cout<<++i<<endl;
    }
  • B
    for (int i:{1,2,3,4,5,6,7,8,9}) {
    cout<<i<<endl;
    }
  • C
    i = 1;
    do {
    cout<<i++<<endl;
    } while(i<10);
  • D
    i = 1;
    loop:
    cout<<i++<<endl;
    if(i<10) goto loop;
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment

Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend