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 ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string[] help = input.Split(' ');
- float[] arrayInput = new float[help.Length];
- List<float> output = new List<float>();
- List<float> anotherOutput = new List<float>();
- for (int i = 0; i < arrayInput.Length; i++)
- {
- arrayInput[i] = float.Parse(help[i]);
- }
- for (int i = 0; i < arrayInput.Length; i++)
- {
- if (arrayInput[i] > (int)(arrayInput[i]))
- {
- output.Add(arrayInput[i]);
- }
- else
- {
- anotherOutput.Add(arrayInput[i]);
- }
- }
- Console.WriteLine("[{0}] -> min:{1}, max:{2}, sum:{3}, avg:{4}", string.Join(" ", output), output.Min(), output.Max(), output.Sum(), String.Format("{0:0.00}", output.Average()));
- Console.WriteLine();
- Console.WriteLine("[{0}] -> min:{1}, max:{2}, sum:{3}, avg:{4}", string.Join(" ", anotherOutput), anotherOutput.Min(), anotherOutput.Max(), anotherOutput.Sum(), String.Format("{0:0.00}", anotherOutput.Average()));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment