Method 1: Using the for loop

RUN the code given below and see the output!

Get hands-on with 1300+ tech skills courses.