-2

A five-digit number is entered through the keyboard. Write a program which will re order the digits of the number from smallest to highest. Like, if you enter 54231 the program will show output as 12345. help me.

5
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by WaltP
Featured Replies
  • 1
    Salem 5,138   6 Years Ago

    [quote=YOU in another spam post] I have been doing programming in C and C++ for two years. I fetch so many problems regarding to global variable and function prototype as well as return value. Try to do coding less complexity as possible as you can. use function to create a … Read More

1

I have been doing programming in C and C++ for two years. I fetch so many problems regarding to global variable and function prototype as well as return value. Try to do coding less complexity as possible as you can. use function to create a task.

ROFLMAO - 2 years, and you can't do this brain-dead exercise.

My idea is you're just another drive-by recycling rubbish from other forums so you can spam your sig-link.

-1

ya Bubble short is the best way.
# program for bubble short:

void bubble(int a[],int n)  
   {  
         int i,j,t;  
          for(i=n-2;i>=0;i--)  
          {  
             for(j=0;j<=i;j++)  
   
                   {  
                     if(a[j]>a[j+1])  
                                     {  
                                       t=a[j];  
                                      a[j]=a[j+1];  
                                      a[j+1]=t;  
                                     }  
                    }  
          
   
            }  
   
   }
   
   
   void main()  
   {  
   
       int a[100],n,i;  
   
    
   
       printf("Enter integer value for total no.s of elements to be sorted: ");  
       scanf("%d",&n);  
   
       for( i=0;i<=n-1;i++)  
             { printf("\n\n Enter integer value for element no.%d : ",i+1);  
               scanf("%d",&a[i]);  
             }  
   
        bubble(a,n);  
   
        printf("\n\n Finally sorted array is: ");  
        for( i=0;i<=n-1;i++)  
       printf("%3d",a[i]);  
   
 } //end program.

Edited by WaltP: Added CODE tags -- with all the help about them, how could you miss using them????

Comments
Spoon-fed, unformatted, non-standard code - ugh!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.