Commit 37708be2 by phkarl

Upload New File

parent 39184b47
Showing with 37 additions and 0 deletions
#include <stdio.h>
#include <math.h>
int main(){
// Declaration
int N;
int i;
int j;
printf("Enter size of array: ");
scanf("%d", &N);
// Declare array
int arr[N];
// Imput values in array
i = 0;
while(i < N){
printf("Enter value in array: ");
scanf("%d", &arr[i]);
i++;
}
i = 0;
while(i < N){
j = 0;
while(j < N - 1){
if(arr[j] < arr[j + 1]){
int swap = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = swap;
}
j++;
}
i ++;
}
for(i = 0; i < N; i++){
printf("%d ", arr[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