001-003-010

Variable Scope in For Loop

Easy

Problem Description

variable Scope in for loop

In this problem, you will create a program that uses a for loop counter variable (i) to iterate from 1 to 3, calculates and outputs double of each number inside the loop, and displays "Loop finished" after the loop ends.

Learning Objective: Understand the scope of variables declared in for loop

Overview

Verify the scope of for loop counter variable and variables declared inside the loop.

Specifications

  • For loop iterating from 1 to 3
  • Calculate and output double of each number inside loop
  • Output "Loop finished" after loop

Output Format

1 * 2 = 2
2 * 2 = 4
3 * 2 = 6
Loop finished

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up