Using For Loop: To increment or decrement a variable by more than one number (correct the program so that the output is as shown:
#include
main()
{
int num;
for (num = 1; num<=100; num+=20) /* increment */
{
printf(""%d\n"",num);
printf(""\n"");}
for (num = 100; num>=1; num-=20) /* decrement */
printf(""%d\n"",num);}
Answers
Answered by
1
"The code given below is used to increase or decrease the variable value by more than one number using 'for Loop'
Img 59_11
To increase the value of the counter variable in the ‘for loop’ in each pass by more than one or to decrease the counter variable more than one in the opposite way. we just need to edit the updating part of the loop."
Attachments:
Similar questions