- using System.IO;
- using System;
- class foreachLoop
- {
- private static void Main(string[] args)
- {
- int [] rollnumbers = new [] {100, 200, 300, 400};
- foreach(int rollnumber in rollnumbers)
- {
- Console.WriteLine("Roll Number: {0}", rollnumber);
- }
- }
- }
-
Output:
Roll Number: 100
Roll Number: 200
Roll Number: 300
Roll Number: 400