Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- void ordonnerTableau(int tableau[], int tailleTableau);
- int main(){
- int tableau[5];
- tableau[0]=30;
- tableau[2]=22;
- tableau[1]=18;
- tableau[3]=35;
- tableau[4]=12;
- printf("Le tableau avant ordonner: ");
- for(int i=0;i<5;i++){
- printf("\ntableau[%d] = %d",i,tableau[i]);
- }
- ordonnerTableau(tableau,5);
- printf("\n\nLe tableau apres ordonner: ");
- for(int i=0;i<5;i++){
- printf("\ntableau[%d] = %d",i,tableau[i]);
- }
- return 0;
- }
- void ordonnerTableau(int tableau[], int tailleTableau){
- int var_pt;
- for(int i=0;i<5;i++){
- for(int j=0;j<5;j++){
- if(tableau[i]<tableau[j]){
- var_pt=tableau[i];
- tableau[i]=tableau[j];
- tableau[j]=var_pt;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement