C


SUBMITTED BY: samuni

DATE: April 18, 2020, 8:23 a.m.

FORMAT: Text only

SIZE: 673 Bytes

HITS: 510

  1. #include <stdio.h>
  2. void main()
  3. {
  4. int i, j, a, n, number[30];
  5. printf("Enter the value of N \n");
  6. scanf("%d", &n);
  7. printf("Enter the numbers \n");
  8. for (i = 0; i < n; ++i)
  9. scanf("%d", &number[i]);
  10. for (i = 0; i < n; ++i)
  11. {
  12. for (j = i + 1; j < n; ++j)
  13. {
  14. if (number[i] > number[j])
  15. {
  16. a = number[i];
  17. number[i] = number[j];
  18. number[j] = a;
  19. }
  20. }
  21. }

comments powered by Disqus