-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
31 lines (30 loc) · 688 Bytes
/
main.c
File metadata and controls
31 lines (30 loc) · 688 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
int main(){
int numbers[100];
srand(time(NULL));
for (int i=0;i<100;i++){
int num = rand()%100;
numbers[i] = num;
}
for (int i=0;i<100;i++){
bool changed = false;
for (int j=0;j<99;j++){
if (numbers[j]<numbers[j+1]){
changed=true;
int between = numbers[j];
numbers[j] = numbers[j+1];
numbers[j+1] = between;
}
}
if (changed==false){
break;
}
}
for (int i=99;i>=0;i--){
printf("%d\n",numbers[i]);
}
return 0;
}