{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 1A - printf"Enter the no of data"...

This preview shows pages 1–2. Sign up to view the full content.

#include<stdio.h> #include<conio.h> /* RISHI AGARWAL             BUBBLE SORT    ROLL NO 02    SE CMPN A */ void swap(int *m,int *n) {  int t;  t=*m;  *m=*n;  *n=t; } void display(int a[],int n) {  int i;  printf("\nLIST\n");  for(i=0;i<n;i++)  printf("%d ",a[i]); } void bsort(int arr[],int n) {  int i,j;  for(i=n-2;i>=0;i--)   for(j=0;j<=i;j++)   {    if(arr[j]>arr[j+1])    {     swap(&arr[j],&arr[j+1]);    }   } } void main() {  int n,i,j,arr[50],t;  clrscr();

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf("Enter the no of data:"); scanf("%d",&n); printf("Enter the nos"); for(i=0;i<n;i++) scanf("%d",&arr[i]); //Displaying List display(arr,n); //Bubble Sort bsort(arr,n); //Displaying Sorted List display(arr,n); getch(); } /* OUTPUT: Enter the no of data:10 Enter the nos100 80 90 70 50 60 10 40 30 20 LIST 100 80 90 70 50 60 10 40 30 20 LIST 10 20 30 40 50 60 70 80 90 100 */...
View Full Document

{[ snackBarMessage ]}