using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace array_alphabet
{
class Program
{
static void Main(string[] args)
{
char[] alphabet= new char[26] ;
string Input;
string IndexOfChar="";
int index = 0;
for (char c = 'A';c<='Z';c++)
{
alphabet[index] = c;
index++;
}
Console.WriteLine("Enter a word:");
Input = Console.ReadLine();
Input = Input.ToUpper();
foreach(char c in Input)
{
for (int i=0;i<26;i++)
{
if (alphabet[i]==c)
{
IndexOfChar = IndexOfChar + i + " ";
break;
}
}
}
Console.WriteLine(IndexOfChar);
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace array_alphabet
{
class Program
{
static void Main(string[] args)
{
char[] alphabet= new char[26] ;
string Input;
string IndexOfChar="";
int index = 0;
for (char c = 'A';c<='Z';c++)
{
alphabet[index] = c;
index++;
}
Console.WriteLine("Enter a word:");
Input = Console.ReadLine();
Input = Input.ToUpper();
foreach(char c in Input)
{
IndexOfChar = IndexOfChar + (Array.IndexOf(alphabet, c)) + " ";
}
Console.WriteLine(IndexOfChar);
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace array_alphabet
{
class Program
{
static void Main(string[] args)
{
char[] alphabet= new char[26] ;
string Input;
int index = 0;
for (char c = 'A';c<='Z';c++)
{
alphabet[index] = c;
index++;
}
Console.WriteLine("Enter a word:");
Input = Console.ReadLine().ToUpper();
foreach(char c in Input)
{
Console.Write ((Array.IndexOf(alphabet, c)) + " ");
}
Console.ReadKey();
}
}
}