void main()
{
int x[10],i,j,temp;
for(i=0;i<=9;i++)
{
printf("Enter %dth number : ",i+1);
scanf("%d",&x[i]);
}
for(i=0;i<=8;i++)
{
for(j=i+1;j<=9;j++)
{
if(x[i]<x[j])
{
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
}
printf("\nThe largest of 10 entered numbers is %d",x[0]);
//printf("\nThe smallest of 10 entered numbers is %d",x[9]);
getch();
}
0 comments:
Post a Comment