Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define N 500
- void array();
- int main(){
- int a[N];
- array(a);
- }
- void array(int a[N]){
- int cero = 0;
- for (int i = 0; i < N; i++){
- a[i] = rand() % 2001;
- }
- for (int i = 1; i < N; i++){
- for (int j = 0; j < N -1; j++){
- if (a[j] > a[j+1]){
- cero = a[j];
- a[j] = a[j+1];
- a[j+1] = cero;
- }
- }
- }
- for (int i = 0; i < N; i++){
- printf("%d\n",a[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment