Convert the following nested do-while loop into a nested for loop:
i = 0;
do
{
i = i+1;
j = i;
do
{
if( (i+j)%2 == 0 )
printf("%d", i);
else
printf("%d", j);
j = j+2;
}while(j < = 10);
}while(i <= 5);
Verify that you get the same output in each case.
The nested do-while loop that needs to be converted to a nested for loop:
i = 0;
do
{
i = i+1;
j = i;
do
{
if( (i+j)%2 == 0 )
printf("%d ", i);
else
printf("%d ", j);
j = j+2;
}while(j <= 10);
}while(i <= 5);
The equivalent nested for loop:
for (int ________ ________ __________ ____ __________.
________ _______ _______ _______ _____ ____ __________ _______ ____ ______ _____.
___ ___ _______ _________ ________ ________ ________ _____ _______ _________.
________ _______ __________ ______ ___ ______ __________ _____ ____ __________.
____ ____ _____ ____ _________ __________ _____ _______.
_____ _______ __________ _________ ___.
_____ _______ ________ _________ ________ _______.
_____ _____ _____ _________ ___ __________.
_______ ____ ________ _______ _________ _________ _________.
______ ___ ________ __________ _____ ___ _______ _________ ______.
_______ _____ __________ _________ ____ _______ _______ _____.
_____ _____ ______ _____ _____ ___ _______ ___ __________ ________ ______ ____.
_______ __________ ___ __________ _____ ___ __________ ____ _________ ____.
____ ___ ____ ____ ___ _______ _____.
_________ ___ ______ ____ _______ ____ __________.
___ _______ __________ ______ _________ __________ __________ ___ ________ ________.
______ _________ ________ _______ _________ ______ ___ __________ _________ ____.
_____ ___ ________ ____ ______ ______ _________ ______ ___ ______ ____ __________.
______ ____ ________ ___ _______ _____ _______ ____ ________.
______ _______ ______ ___ ___.
_________ _________ _____ ____ _______ ________ _______ _______ __________ __________ ________ _______.
_______ ______ ___ ___ __________ ___.
______ ____ ______ ___ _________ __________ ___ _____.
________ _____ _________ ____ _____ _______.
__________ ______ _____ _____ _______ _________.
____ ___ ___ _____ ______ ____ ___ _______ ________ _______ ____ _______.
_____ ______ ____ ____ ___ ____ __________ _______ _____.
_______ ___ _________ ____ _________ _____ ________ _____ ________ ________ _______.
_______ _______ __________ ___ ___ ________ ___ _____ __________.
_____ __________ ___ ____ _______ _____ ______ ______ ____ _____ __________.
__________ ____ ______ _______.
Get Full Answer on WhatsApp