no one can solve this problem...

numbers in non-decreasing in its last digit, and the last digit being equal - in non-decreasing numbers themselves.i should print like that
Example input
7
12 15 43 13 20 1 15
Example output
20 1 12 13 43 15 15

but i couldn`t. how can i do this?it is my solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <stdlib.h>
int say,t[100],i,x[100],min,m,j,l,k,b;
int main()
{
scanf("%d",&say);
for (i=0; i<say; i++ )
scanf("%d",&t[i]);
for (i=0; i<say; i++ )
x[i]=t[i]%10;
for (i=0; i<say; ++i){
min = x[i];
m = i;
for (j=i; j<say; ++j)
if (x[j] < min){
min = x[j];
m = j;
}
l = x[i];
x[i] = min;
x[m] = l;
}
for (i=0; i<say; i++)
printf("%d\n",x[i]);



  system("PAUSE"); 
  return 0;
}

Last edited on
Could you please re-explain your question, I don't understand what you're asking. Also, system commands... meh
it is that problem:

Cunning sorting
Given a sequence of numbers. Need to streamline these numbers in non-decreasing in its last digit, and the last digit being equal - in non-decreasing numbers themselves.


Specifications
Input

The first line contains the number n ( 1 ≤ n ≤ 100 ), and the second - their own natural numbers not exceeding 32 000 .

Output

In the output file output sequence, ordered according to the condition.
@ ascii: There's only one "system" call, I'm more horrified by the spacing.

@ OP: Your code is a lot easier to read if you copy paste it from your IDE. If this is how it was written in your IDE then You should work on your spacing, it makes it easier to identify problems in your own code.
and here is linkhttp://www.e-olimp.com.ua/en/problems/1462
All I said was meh... meh

Anyhow, if I understand you're trying to sort a series of numbers by their last digit. Just read the number into an array, and then all it takes to access the last digit is to get the remainder (modulus) of the number divided by 10.
Last edited on
Topic archived. No new replies allowed.