1: #include<stdio.h>
2: #include<conio.h>
3: #include<stdlib.h>
4: #define MAX 5
5: void main()
6: {
7: int i,hold,pass,a[MAX];
8: clrscr();
9: printf("Enter the numbers:\n");
10: for(i=0;i<=MAX-1;i++)
11: {
12: scanf("%d",&a[i]);
13: }
14: printf("\n");
15: printf("Array in sorted order is:\n");
16: for (pass=1;pass<MAX;pass++)
17: {
18: for (i=0;i<=MAX-pass;i++)
19: {
20: if (a[i]>a[i+1])
21: {
22: hold=a[i];
23: a[i]=a[i+1];
24: a[i+1]=hold;
25: }
26: }
27: }
28: for(i=0;i<=MAX-1;i++)
29: {
30: printf("%d\t",a[i]);
31: }
32: getch();
33: }
getsprogramming Tutorials , C Programming, CPP Programming and JAVA Programming , Python Programming , Javascript Programming Welcome to getsprogramming Blog Here You Find Different Programs in Easier way to Explain and gain Knowledge and Try Your Self..Thanks
Tuesday, 29 September 2015
Write a C rogram To Perform Bubble Sort using Insertion Of Numbers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment