//sort-numbers-in-ascending-order-using-dma
#include <stdio.h>
#include <math.h>
void main(){
    int a,t;
    printf("ENTER THE LIMIT OF ARRAY :\n");
    scanf("%d",&a);
    int arr[a],*p;
    for(int i=0;i<a;i++){
        scanf("%d\n",&arr[i]);
    }
    printf("\tARRAY \t=\n");
    for(int i=0;i<a;i++){
        printf("%d\n",arr[i]);
    }
    printf("the value of a=%d\n",a);
    p=&arr[0];
    for(int i=0;i<5;i++){
        for(int j=i+1;j<a;j++){
      if(*(p+i)>*(p+j)){
          t=*(p+i);
          *(p+i)=*(p+j);
          *(p+j)=t;
      }
        }
    }
    printf("SORTING OF AN ARRAY OUTPUT =\n");
    for(int i=0;i<a;i++){
        printf("%d\n",*(p+i));
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: