#include<stdio.h>
#include<conio.h>
void main()
{
int *arr, temp, i, j, n;
clrscr();
printf(“enter the number of elements in the array”);
scanf(“%d”, &n);
arr=(int*)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
{
for(j=i+1; j<n; j++)
{
if(arr[i]<arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
printf(“Elements of array in descending order are”);
for(i=0; i<n; i++);
getch();
}
Comments
Post a Comment