#include <stdio.h>
void main (){
int num[20];
int i, j, a, n;
printf("Number of array :");
scanf("%d", &n);
printf("Enter Random Number : ");
void main (){
int num[20];
int i, j, a, n;
printf("Number of array :");
scanf("%d", &n);
printf("Enter Random Number : ");
for (i = 0; i < n; ++i)
scanf("%d", &num[i]);
for (i = 0; i < n; ++i){
for (j = i + 1; j < n; ++j){
if (num[i] < num[j]){
a = num[i];
num[i] = num[j];
num[j] = a;
}
}
}
printf("Descending order :\n");
for (i = 0; i < n; ++i){
printf("%d\n", num[i]);
}
}
No comments:
Post a Comment