Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

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.

What you will learn

  • How to find the index of a letter in an array in C#?
  • What is the use of the ToCharArray() method in C#?
  • How to create an array of alphabet letters in C#?

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