4. C# — Count Vowels in One Line
using System;
✅ Cool because:
-
Functional style.
-
Easy to adapt for consonants, digits, etc.
✍️ Written by Luis Fernandez Leyva, Software Engineer
using System;
using System.Linq; class Program { static void Main() { string text = "Hello Florida"; // Count vowels int vowelCount = text.Count(c => "aeiouAEIOU".Contains(c)); Console.WriteLine($"Vowels: {vowelCount}"); } }
✅ Cool because:
Functional style.
Easy to adapt for consonants, digits, etc.
✍️ Written by Luis Fernandez Leyva, Software Engineer
Comments
Post a Comment