Created
April 6, 2017 21:19
-
-
Save Reflej0/5e71742145db231c5533c7cd3291c3bf to your computer and use it in GitHub Desktop.
Algoritmo en C# para encontrar las palabras terminadas en cion, dentro de una frase con varias palabras.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Ingrese una frase"); | |
string frase = Console.ReadLine(); | |
string[] palabras = frase.Split(' '); | |
int palabrascion = 0; | |
for (int i = 0; i < palabras.Length; i++) | |
{ | |
if (palabras[i][palabras[i].Length - 1] == 'n' && palabras[i][palabras[i].Length - 2] == 'o' && palabras[i][palabras[i].Length - 3] == 'i' && palabras[i][palabras[i].Length - 4] == 'c') | |
{ | |
palabrascion++; | |
} | |
} | |
Console.WriteLine("Las palabras terminadas en cion son:{0}", palabrascion); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment