
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This c# program demonstrates how to create an array containing all letters of the alphabet and find the index of each letter in the array when a user inputs a word. The code uses a string array and char array, and a for loop to iterate through each character in the array and find its index.
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

...urce\repos\BSIT3-2\ArrayPt.3_B\ArrayPt.3_B\Program.cs 1 //Rivas, Joy B. //BSIT 3- 2 //Write a program that creates an array containing all letters from the alphabet (A-Z). //Read a word from the console and print the index of each of its letters in the array. string[] index = new string [26]; string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char[] array = alphabet.ToCharArray(); for (int i = 0; i < array.Length; i++) { char letter = array[i]; } //Console.WriteLine(alphabet); Console.WriteLine(alphabet.IndexOf("J"));