Sort by last digit
Problem
You are given a sequence of integers. Write a program that creates and sorts an array in descending order of the last digit in a number.
Input
First given number N - number of elements in sequence (1<= N <= 100). Then N numbers are written separated by a space.
Output
It is necessary to output an array sorted in descending order of the last digit in the number.
Examples
| # |
Input |
Output |
| 1 |
5
5 100 23 777 34
| 777 5 34 23 100 |