Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Insersting sorting
- //Mir Shamim Nahid
- #include <stdio.h>
- int main ()
- {
- int arr[10];
- int i,j, value,n,k;
- printf("Enter Number of input:");
- scanf("%d",&n);
- printf("Enter %d number: ",n);
- for(k=0;k<n;k++)
- {
- scanf("%d",&arr[k]);
- }
- for(i=1;i<n;i++)
- {
- value=arr[i];
- j=i-1;
- while(j >=0 && value<arr[j])
- {
- arr[j+1]=arr[j];
- j--;
- }
- arr[j+1]=value;
- }
- printf("After Sorting: \n");
- for(i=0; i<n; i++)
- {
- printf("%d ",arr[i]);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment