Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a Go program to demonstrate the use of a for loop with range to iterate over an array.

Easy

Problem Statement

Write a Go program to demonstrate the use of a for loop with range to iterate over an array.

Sample Input

An array of strings (e.g., ["Apple", "Banana", "Cherry"]).

Sample Output

Index: 0, Value: Apple
Index: 1, Value: Banana
Index: 2, Value: Cherry

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" func main() { // Iterate over the array using a range loop }
Log in or sign up to run or submit your code.Log inSign up
Input
An array of strings (e.g., ["Apple", "Banana", "Cherry"]).
Expected Output
Index: 0, Value: Apple
Index: 1, Value: Banana
Index: 2, Value: Cherry