Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int i, j, a[10],n,temp;
- printf("enter the value :");
- scanf("%d", &n);
- printf("enter the element of array: ");
- for(i=0; i<n; i++)
- scanf("%d", &a[i]);
- for(i=0; i<n-1; i++) //loop for items
- {
- for(j=0; j<n-i; j++) // lop for inside the items
- {
- if(a[j]> a[j+1])
- {
- temp=a[j];
- a[j ]=a[j+1]; //sawping the temp value
- a[j+1]=temp;
- }
- }
- }
- for(i=0; i<n; i++)
- printf("%d", a[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement