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 CategorizeMinMax
- {
- class _03CategorizeMinMax
- {
- static void Main(string[] args)
- {
- double[] arr = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
- List<double> doubleSet = new List<double>();
- List<double> intSet = new List<double>();
- for (int i = 0; i < arr.Length; i++)
- {
- if (arr[i]%1 !=0)
- {
- doubleSet.Add(arr[i]);
- }
- if (arr[i] % 1 == 0)
- {
- intSet.Add(arr[i]);
- }
- }
- Console.WriteLine("Double");
- Console.Write(string.Join(" ", doubleSet));
- Console.WriteLine();
- Console.Write("min {0}; max {1}, sum {2}, average {3:f2}", doubleSet.Min(), doubleSet.Max(),doubleSet.Sum(), doubleSet.Average());
- Console.WriteLine();
- Console.WriteLine("Int");
- Console.Write(string.Join(" ", intSet));
- Console.WriteLine();
- Console.Write("min {0}; max {1}, sum {2}, average {3:f2}", intSet.Min(), intSet.Max(), intSet.Sum(), intSet.Average());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement