Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a[3][4]={8,7,6,5,
  5. -2,800,19,-40,
  6. 1,-23,600,-500
  7. };
  8. int t=0;
  9. int *p=&a[0];
  10. for(int i=0;i<=12;i++)
  11. {
  12. for(int j=0;j<=11;j++)
  13. {
  14. if(*(p+j+1)<*(p+j))
  15. {
  16. t=*(p+j);
  17. *(p+j)=*(p+j+1);
  18. *(p+j+1)=t;
  19. }
  20. }
  21. }
  22. printf("after sorting in ascending order (from low to high) \n");
  23. for(int i=0;i<=2;i++)
  24. {
  25. for(int j=0;j<=3;j++)
  26. {
  27. printf("%d\t",a[i][j]);
  28. }
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement