Created
September 17, 2020 09:25
-
-
Save achmadweb/6c4ba7bdb66857969676af461f84fde6 to your computer and use it in GitHub Desktop.
Maximum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int i; | |
int Tab[10]= {1, 50, 6, 200, 3, 100, 30, 8, 99, 100 }; | |
int max; | |
int k, temp; | |
for (i=0; i<9; i++) { | |
max=1; | |
for (k= i+1 ;k< 10; k++) { | |
if (Tab[k]>Tab[max]) { | |
max=k; | |
} | |
} | |
temp= Tab[i]; | |
Tab[i]= Tab[max]; | |
Tab[max] = temp; | |
} | |
for (i=0; i<10; i++) { | |
printf (" %d ; ", Tab[i]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment