Question

Write a for loop that prints out all the even numbers between 100 and 2 in...

Write a for loop that prints out all the even numbers between 100 and 2 in reverse order, i.e., 100, 98, 96, etc. (4 Points) NOTE: Write just the for loop no classes or methods such as main.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

here given loop will print all even numbers between 100 and 2

C code :

int i;

for(i =100; i >= 2; i=i-2){ // after each loop decrement value of i by 2.
printf("%d\n", i); // print value of i
}

loop will be executed till the value of i is between 2 and 100.

i is initialized with 100 to print it in reverse order.

if you have any doubts, you can ask in comment section.

Add a comment
Know the answer?
Add Answer to:
Write a for loop that prints out all the even numbers between 100 and 2 in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT