Method 1: Using the for loop

RUN the code given below and see the output!

Get hands-on with 1400+ tech skills courses.