//program is implemented by shadab khan
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[5], i,j,t,p,s;
cout<<”enter the 5 element of array”;
for(i=0;i<=4;i++)
cin>>a[0];
for(i=0;i<=4;i++)
{
s=a[i];
p=I;
for(j=i=1;j<=4;j++)
{
if(s>a[j])
{
s=a[j];
p=j;
}
}
t=a[i];
a[i]=a[p];
a[p]=t;
}
cout<<”5 sorted elements of array”;
for(i=0;i<=4;i++)
cout<<a[i];
getch();
}
No comments:
Post a Comment