#include<stdio.h>
#include<stdio.h>
void main()
{
int i,n=10,k[10],last,exch,temp,pass;
clrscr();
for(i=1;i<n-1;i++)
{
printf("\n\t\tEnter No:-");
scanf("%d",&k[i]);
}
printf("\n\n\t\tPress any key for sorting........");
last=n;
for(pass=1;pass<n-1;pass++)
{
exch=0;
for(i=1;i<last-1;i++)
{
temp=k[i];
k[i]=k[i-1];
k[i-1]=temp;
exch=exch+1;
}
if(exch==0)
{
}
else
{
last=last-1;
}
}
for(i=1;i<n;i++)
{
printf("\n\t\t %d ",k[i]);
}
getch();
}
#include<stdio.h>
void main()
{
int i,n=10,k[10],last,exch,temp,pass;
clrscr();
for(i=1;i<n-1;i++)
{
printf("\n\t\tEnter No:-");
scanf("%d",&k[i]);
}
printf("\n\n\t\tPress any key for sorting........");
last=n;
for(pass=1;pass<n-1;pass++)
{
exch=0;
for(i=1;i<last-1;i++)
{
temp=k[i];
k[i]=k[i-1];
k[i-1]=temp;
exch=exch+1;
}
if(exch==0)
{
}
else
{
last=last-1;
}
}
for(i=1;i<n;i++)
{
printf("\n\t\t %d ",k[i]);
}
getch();
}
No comments:
Post a Comment