int main()
{
int i,j,temp,x,y;
int a[]={16,70,8,100,9,85};
int n = sizeof(a)/sizeof(a[0]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n-1;j++)
{
if(a[i]<a[j])
{
temp=a[i];
a[i]=a[j];
a[j] = temp;
}
}
x=a[i],y=a[i-1];
}
printf("\nFirst smallest %d and second smallest is %d",x,y);
}
Comments
Post a Comment