Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace liNEAL
- {
- class Program
- {
- static void Main(string[] args)
- {
- char leter;
- char[] letra = new char[26];
- for (int i = 0; i < 26; i++)
- {
- letra[i] = (char)((int)+65+i);
- }
- //Aqui comienza el algoritmo
- Console.WriteLine("Ingrese una letra: ");
- leter = Convert.ToChar(Console.ReadLine().ToUpper()); //Paso 1
- //Paso 2
- for (int i = 0; i < 26; i++)
- {
- if (leter == Convert.ToChar(letra[i]))
- {
- Console.WriteLine("Se encontro la: " + leter + " letra en " + (i + 1) + " posicion"); //Paso 3
- break;
- }
- else if (i == 25)
- {
- //Paso 3
- Console.WriteLine("No encontro la: " + leter + " letra en el arreglo ");
- break;
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement