Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Bubble Sorting
- //Mir Shamim Nahid
- #include <stdio.h>
- int main ()
- {
- int arr[10];
- int n,k;
- int i,j,temp;
- 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=0; i<n-1; i++)
- {
- for(j=0; j<n-1-i; j++)
- {
- if(arr[j]>arr[j+1])
- {
- temp= arr[j];
- arr[j]=arr[j+1];
- arr[j+1]=temp;
- }
- }
- }
- printf("Atfer sorting: \n");
- for(i=0; i<n; i++)
- {
- printf("%d ",arr[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement