h>
#include <conio.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <ctype.h>
void main()
{
clrscr();
int number[10]={9,8,7,6,5,1,3,2,4,9};
int cnt;
cnt=0;
while(cnt!=10)
{
printf("%d ",number[cnt]);
cnt++;
}
printf("\n\n");
printf("Small to bigger --> ");
int x,y;
for(x=0;x<cnt-1;x++)
{
for(y=0;y<cnt-1;y++)
{
int temp;
if(number[y]>number[y+1])
{
temp=number[y+1];
number[y+1]=number[y];
number[y]=temp;
}
}
}
cnt=0;
while(cnt!=10)
{
printf("%d ",number[cnt]);
cnt++;
}
getch();
printf("\n");
printf("Bigger to small --> ");
for(x=0;x<cnt-1;x++)
{
for(y=0;y<cnt-1;y++)
{
int temp;
if(number[y]<number[y+1])
{
temp=number[y+1];
number[y+1]=number[y];
number[y]=temp;
}
}
}
cnt=0;
while(cnt!=10)
{
printf("%d ",number[cnt]);
cnt++;
}
getch();
}