Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
486 B
2
Indexable
Never
#include<stdio.h>
void main(){
    int i,j,n
    ;
    int temp,num[100];
    printf("enter numbers of elements you want to sort");
    scanf("%d",&n);
    printf("enter the numbers");
    for(i=0;i<n-1;i++){
        for(j=0;j<n-i-1;j++){
            if(num[j]>num[j+1])
            {
                temp=num[j];
                num[j]=num[j+1];
                num[j+1]=temp;
            }
        }
    }
    printf("the number is ascending order is %d",num[i]);
}
Leave a Comment