Write a program to arrange given set of number in ascending order using link lists in c language?
-
-
Answer:
#include <stdio.h> #include <conio.h> int main() { int a[10],i,j,temp=0; printf("Enter all the 10 numbers"); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<10;i++) //This loop is for total array elements (n) { for(j=0;j<9;j++) //this loop is for total combinations (n-1) { if(a[j]>a[j+1]) //if the first number is bigger then swap the two numbers { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } printf("The ordered array is"); for(j=0;j<10;j++) //Finally print the ordered array printf("%d \t",a[j]); getch(); return 0; }
community wiki at wiki.answers.com Visit the source
Related Q & A:
- How to write a parser in C?Best solution by Stack Overflow
- How to write a program to monitor the temperature of CPU?Best solution by Stack Overflow
- How to become a good programmer in C language?Best solution by Quora
- How to write a TV program proposal?
- If someone calls within usa using a phone card does it show their number on caller id or something else?Best solution by 800notes.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.