[ create a new paste ] login | about

Link: http://codepad.org/h0F6oJ2X    [ raw code | output | fork ]

C, pasted on May 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>

int main(void){
	double num[30],tmp;
	int i,s;
	
	for(i=0;i<30;i++){scanf("%lf",&num[i]);}
	
	for(i=0;i<30;i++){
		for(s=i;s<30;s++){
			if(num[i]>num[s]){
				tmp=num[s],num[s]=num[i],num[i]=tmp;
			}
		}
	}
	
	for(i=0;i<30;i++){printf("%lf\n",num[i]);}
	
	return 0;
}


Output:
-0.000784
-0.000784
-0.000784
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
2.055269
2.082254
2.166871
2.166871
2.168046
2.168046
2.181384
2.189515
2.190018
2.195313
2.228371
2.329751
2.335754
2.374477
3.854011
5.200334
5.200334
5.201203


Create a new paste based on this one


Comments: