Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _06._Square_Numbers
- {
- class SquareNumbers
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine()
- .Split(' ')
- .Select(s => int.Parse(s))
- .ToList();
- List<int> selected = numbers.Where(num => Math.Sqrt(num) == (int)Math.Sqrt(num)).ToList();
- selected = selected.OrderByDescending(a => a).ToList();
- Console.WriteLine(string.Join(" ", selected));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement