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;
- class Program
- {
- static void Main()
- {
- string[] numbers = Console.ReadLine().Split(' ');
- float[] floatNums = new float[numbers.Length];
- List<float> floatNumbers = new List<float>();
- List<int> roundNumbers = new List<int>();
- for (int i = 0; i < numbers.Length; i++)
- {
- floatNums[i] = float.Parse(numbers[i]);
- int intNum = (int)floatNums[i];
- if (intNum != floatNums[i])
- {
- floatNumbers.Add(floatNums[i]);
- }
- else
- {
- roundNumbers.Add(intNum);
- }
- }
- Console.Write("[ ");
- for (int k = 0; k < floatNumbers.Count; k++)
- {
- Console.Write(floatNumbers[k] + " ");
- }
- Console.Write(" ]");
- Console.WriteLine();
- Console.Write("Min = {0}, Max = {1}, Sum = {2}, Avg = {3} ", floatNumbers.Min(), floatNumbers.Max(), floatNumbers.Sum(), floatNumbers.Average());
- Console.WriteLine();
- Console.Write(" [ ");
- for (int j = 0; j < roundNumbers.Count; j++)
- {
- Console.Write(roundNumbers[j] + " ");
- }
- Console.Write(" ]");
- Console.WriteLine();
- Console.Write("Min = {0}, Max = {1}, Sum = {2}, Avg = {3} ", roundNumbers.Min(), roundNumbers.Max(), roundNumbers.Sum(), roundNumbers.Average());
- Console.WriteLine();
- Console.WriteLine("The end :)");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement