How can I rewrite the following while loop using a for loop?

Printable View