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 _02ArrayAndListAlgorithumsAverageCharDemiliters
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> inputTokens = Console.ReadLine().Split().ToList();
- double tokensSum = 0;
- int chartotal = 0;
- for (int i=0;i<inputTokens.Count;i++)
- {
- char[] temp = inputTokens[i].ToCharArray();
- for (int j=0;j< temp.Length;j++)
- {
- tokensSum += (int)temp[j];
- chartotal++;
- }
- }
- char demiliter = (char)(Math.Floor(tokensSum /chartotal));
- if ((char)97 <= demiliter || demiliter <= (char)122)
- {
- Console.WriteLine(string.Join($"{demiliter.ToString().ToUpper()}", inputTokens));
- }
- else
- {
- Console.WriteLine(string.Join($"{demiliter}", inputTokens));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment