Given An Integer Array Write A Program To Sort The First K Elements of This Array in Ascending and Remaining Elements in Descending Order in C
Given An Integer Array Write A Program To Sort The First K Elements of This Array in Ascending and Remaining Elements in Descending Order in C
/******************************************************************************
Online C Compiler.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
int*findArrSort(int*arr,int len,int k)
int i, j, temp;
if(arr[i]<arr[j])
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
/* from k+1 elements upto n elements in an array and sort that in descending order*/
if(arr[i]>arr[j])
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
return arr;
int main()
int i,*b,arr[100],len,k;
scanf("%d",&k);
scanf("%d",&arr[i]);
b=findArrSort(arr,len,k);
printf("%d ",b[i]);
return 0;