Method 1: Using the for loop

RUN the code given below and see the output!

Get hands-on with 1200+ tech skills courses.