C# Program to Find Index of Letters in the Alphabet Array, Exercises of Javascript programming

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

2021/2022

Uploaded on 06/03/2022

jj-toraja
jj-toraja 🇵🇭

5 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
...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"));

Partial preview of the text

Download C# Program to Find Index of Letters in the Alphabet Array and more Exercises Javascript programming in PDF only on Docsity!

...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"));