Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define NUM 10
- void intsrt(int array[], int num);
- int main(void){
- int random[NUM];
- int x;
- for(x=0; x<NUM; x++){
- random[x]=rand()%NUM+1;
- }
- printf("\n");
- intsrt(random, NUM);
- for(x=0; x<NUM; x++){
- printf("%d\n", random[x]);
- }
- return 0;
- }
- void intsrt(int array[], int num){
- int temp;
- int top, seek;
- for(top=0; top<num-1; top++){
- for(seek=top+1; seek<num; seek++){
- if(array[top]>array[seek]){
- temp=array[top];
- array[top]=array[seek];
- array[seek]=temp;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement