#define MAX 5
int main()
{
int x=1,i,flag=1,a[MAX],b[MAX],j=0,k;
for(i=0;i<MAX;i++)
{
printf("Enter Number:");
scanf("%d",&a[i]);
}
while(flag)
{
flag=0;
for(i=0;i<=9;i++)
{
for(k=0;k<MAX;k++)
{
if((a[k]/x)%10==i)
{printf("%d %% %d\n",a[k],x);
b[j++]=a[k];
}
if((a[k]/x)%10!=0)
flag=1;
}
}
x*=10;
for(i=0;i<MAX;i++)
{
a[i]=b[i];
printf("%d\n",a[i]);
}
printf("f%d\n",flag);
getch();
j=0;
}
printf("Sorted array is\n");
for(i=0;i<MAX;i++)
{
printf("%d\n",a[i]);
}
getch();
}
This blog will cover all important aspects of 'C' 'C++', 'Data Structures in C' and other Technical stuffs. In this blog you will find good C Interview Questions Answers. I will be posting both multiple choice and subjective type C interview questions and answers. Tutorials will be posted from time to time that will focus on problem solving.
Sunday, October 2, 2011
Digital Sort C program Dev C++
Labels:
sorting
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment