Consider the two C code fragments given below.
Code 1:
int i;
i=0;
while(i < 10)
{
// Single Line of Code Here
printf("\n%d",i);
i++;
}
Code 2:
int i;
for(i=0; i < 10; i++)
{
// Single Line of Code Here
printf("\n%d",i);
}
The Output will be same for both the codes. The Output is shown below.
Code 1:
int i;
i=0;
while(i < 10)
{
// Single Line of Code Here
printf("\n%d",i);
i++;
}
Code 2:
int i;
for(i=0; i < 10; i++)
{
// Single Line of Code Here
printf("\n%d",i);
}
The Output will be same for both the codes. The Output is shown below.
The Challenge is to obtain different outputs for the two codes by adding the same single line of code in place of the comment. You should not make any changes in the code other than replacing the comment with the same single line of code. There might be different ways to solve the puzzle.
No comments:
Post a Comment