Complete the following programs for following output
for (a=1; a<=6; a++)
{ if (a%2)
continue;
else
printf(''%d\n" , a);
printf("end of loop\n);
}
Answers
Answered by
0
"Img 58_11
The logic behind the working of the program is: A variable 'a' is declared and its value is increased by 1 up to 6 through the iteration.
By iteration, the calculation involving more steps will be made in lesser steps done in simplest way.
Also, if 'a' is divisible completely by 2 the loop continues, if not, it prints the number, thus, printing all the odd numbers from 1 to 6."
Attachments:
Similar questions
Physics,
6 months ago
Accountancy,
6 months ago
Math,
6 months ago
Math,
1 year ago
Computer Science,
1 year ago
Biology,
1 year ago