#include<iostream>
using namespace std;
void selectionsort(int a[],int n){
for(int i=1;i<n;i++){
int min=a[i-1],temp;
int j=i;
for(;j<n;j++){
if(a[j]<min){
temp=min;
min=a[j];
a[j]=temp;
}
}
}
}
void main(){
int n;
cout<<"enter n(n<100):";
cin>>n;
int a[100];
cout<<"a[n]:";
for(int i=0;i<n;i++){
cin>>a[i];
}
selectionsort(a,n);
cout<<"a[n](after selectionsort):";
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
}
using namespace std;
void selectionsort(int a[],int n){
for(int i=1;i<n;i++){
int min=a[i-1],temp;
int j=i;
for(;j<n;j++){
if(a[j]<min){
temp=min;
min=a[j];
a[j]=temp;
}
}
}
}
void main(){
int n;
cout<<"enter n(n<100):";
cin>>n;
int a[100];
cout<<"a[n]:";
for(int i=0;i<n;i++){
cin>>a[i];
}
selectionsort(a,n);
cout<<"a[n](after selectionsort):";
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
}