Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "fun.h"
- #include <stdio.h>
- #include <time.h>
- #include <stdlib.h>
- void fun(){
- int mas[20],r;
- srand(time(NULL));
- for(int i = 0; i < 20; i++){
- r = (rand() % 100) - 50;
- mas[i] = r;
- printf("%i | ",mas[i]);
- }
- int count = 0;
- while(count < 20){
- for(int i = 0; i < 19; i++){
- int temp;
- if(mas[i] < mas[i+1]){
- temp = mas[i];
- mas[i] = mas[i+1];
- mas[i+1] = temp;
- }
- }
- count++;
- }
- printf("\n1): %i, 2): %i, 3): %i", mas[0], mas[1], mas[2]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement