1. A one-dimensional array that contains six (6) names of your classmates. Then, print the names using a foreach loop.
2. A two-dimensional array with two (2) rows and three (3) columns. Then, initialize the array with the first six (6) letters of the alphabet as its elements.
3. A string with any message. Then, determine if the message contains the string, "hello".
using System;
class Program {
public static void Main (string[] args) {
string []classmates=new string[6];
Console.WriteLine("Please enter 6 names your classmate");
for(int i=0;i<6;i++)
{
classmates[i]=Console.ReadLine();
}
Console.WriteLine("***********Out for foreach loop*******************");
foreach(string itm in classmates)
Console.WriteLine(itm);
Console.ReadKey();
}
}
Comments
Leave a comment