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 _09_VowelsSum
- {
- class VowelsSum
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine();
- int sum = 0;
- //Console.WriteLine(text[0]);
- for (int i = 0; i < text.Length; i++)
- {
- //Console.WriteLine(text[i]);
- char currentLeter = text[i];
- if (text[i] == 'a')
- {
- sum += 1;
- }
- else if (text[i] == 'e')
- {
- sum += 2;
- }
- else if (text[i] == 'i')
- {
- sum += 3;
- }
- else if (text[i] == 'o')
- {
- sum += 4;
- }
- else if (text[i] == 'u')
- {
- sum += 5;
- }
- }
- Console.WriteLine("Vowels sum = " + sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment