Are you really good at C++ Programming?

1
2
3
4
5
6
7
8
9
int main(){
    for(int z=1;;){
        if(z<=11)
            z+=z;
        else
            cout<<++z%4; break;
    }
    return 0;
}

\implies Can you guess the output..?

3 1 2 0

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Hasmik Garyaka
Sep 12, 2017

z will twice until 16. Then it will increase to 17 and mod 4=0;

17 mod 4 is 1 not 0

SaurAv Dasgupta - 2 years, 11 months ago

Log in to reply

Ok. This is the answer. It was typo

Hasmik Garyaka - 2 years, 11 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...