Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n,i,j,k,min;
- printf("How Many Inputs? : ");
- scanf("%d",&n);
- int a[n];
- printf("\nNow Start Entering %d Inputs\n",n);
- for(i=0 ; i<n ; i++) //for taking inputs into array
- {
- scanf("%d",&a[i]);
- }
- for(i=0 ; i<n ; i++) //for sorting
- {
- min=a[i];
- for(j=i+1 ; j<n ; j++)
- {
- if(min>a[j])
- {
- min=a[j];
- a[j]=a[i];
- a[i]=min;
- }
- }
- }
- printf("Here's the Sorted Version: ");
- for(i=0 ; i<n ; i++) //for printing
- printf("%d ",a[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement