Advertisement
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 Problem3
- {
- class Program
- {
- static void Main(string[] args)
- {
- float[] intList = Console.ReadLine().Split(' ').Select(float.Parse).ToArray();
- List<float> roundNumbers = new List<float>();
- List<float> notRoundNumber = new List<float>();
- for (int i = 0; i < intList.Length; i++)
- {
- if (intList[i] % 1 == 0)
- {
- roundNumbers.Add(intList[i]);
- }
- else
- {
- notRoundNumber.Add(intList[i]);
- }
- }
- Console.WriteLine("[{0}]-> min={1}, max={2}, sum={3}, avg={4:f2}", string.Join(", ", notRoundNumber), notRoundNumber.Min(), notRoundNumber.Max(), notRoundNumber.Sum(), notRoundNumber.Average());
- Console.WriteLine("[{0}]-> min={1}, max={2}, sum={3}, avg={4:f2}", string.Join(", ", roundNumbers), roundNumbers.Min(), roundNumbers.Max(), roundNumbers.Sum(), roundNumbers.Average());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement