Commit e82689c3 by viakul

Upload New File

parent 064a5106
Showing with 40 additions and 0 deletions
#include <stdio.h>
int main(){
int N;
int i;
int j;
printf("How many number do you want to have in array: \n");
scanf("%d", &N);
int array[N];
for (i=0; i<N; i++){
printf("write your number: \n");
scanf("%d", &array[i]);
}
i=0;
int swap;
while(i<N){
j=0;
while(j<N-1){
if(array[j]<array[j+1]){
swap = array[j];
array[j]=array[j+1];
array[j+1]=swap;
j++;
}else{
j++;
}
}
i++;
}
printf("\n");
for(i=0; i<N; i++)
{
printf("%d \n", array[i]);
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment