1.

Given the following code fragment:i=2;start:cout<<i;i+=2;if(i<51) goto start;cout<<"\nThank You";Rewrite the above code using a while loop.

Answer»

int i=2;

while(i<51)

{

cout<<i;

i+=2;

}

cout<<"\nThank You";



Discussion

No Comment Found

Related InterviewSolutions