Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _06a_Lists_Lab
- {
- class Lists_Lab
- {
- static void Main(string[] args)
- {
- List<int> numList = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();
- List<int> squareNumbers = new List<int>();
- for (int i = 0; i < numList.Count; i++)
- {
- if (Math.Sqrt(numList[i]) == (int)Math.Sqrt(numList[i]))
- {
- squareNumbers.Add(numList[i]);
- }
- }
- squareNumbers.Sort((a, b) => b.CompareTo(a));
- Console.WriteLine(string.Join(" ", squareNumbers));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement