{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

1C - scanf"%d"&n printf"Enter the nos"...

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

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> /* RISHI AGARWAL             INSERTION SORT    ROLL NO 02    SE CMPN A */ void display(int a[],int n) {  int i;  printf("\nLIST\n");  for(i=0;i<n;i++)  printf("%d ",a[i]); } void isort(int arr[],int n) {  int i,j,x;  for(i=1;i<=n-1;i++)  {   x=arr[i];   j=i;   while((arr[j-1]>x)&&(j>0))   {    arr[j]=arr[j-1];    j--;   }  arr[j]=x;  } } void main() {  int n,i,j,arr[50],t;  clrscr();  printf("Enter the no of data:");
Background image of page 1

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

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: scanf("%d",&n); printf("Enter the nos"); for(i=0;i<n;i++) scanf("%d",&arr[i]); //Displaying List display(arr,n); //Insertion Sort isort(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 ]}