Voici mon programme de tri par ordre croissant sa fonctionne pas pk ? ou est le probléme svp !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
31
32
33 #include <stdio.h> #include <stdlib.h> int main() { int i,j,posmin,n,temp; int t[10]; scanf("%d", &n); for(i=0 ;i<n ; i++) { scanf("%d", &t[i]); } for(i=0 ;i<n ;i++); { posmin=i; for(j=i+1;j<n;j++) { if (t[j]<t[posmin]) posmin=j; } temp=t[posmin]; t[posmin]=t[i]; t[i]=temp; } for(i=0 ;i<n ;i++) { printf("%d" ,t[i]); } }
Partager