Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void deslocamento_esquerda (int array[], int i)
  4. {
  5.     int aux;
  6.     if (array [i] > array [i + 1])
  7.     {
  8.         aux = array [i];
  9.         array [i] = array [i + 1];
  10.         array [i + 1] = aux;
  11.     }
  12. }
  13.  
  14. void ler_array (int array[], int i)
  15. {
  16.     if (i < n)
  17.     {
  18.         scanf("%d", &array[i]);
  19.         ler_array(array, i + 1);
  20.     }
  21. }
  22.  
  23. int main()
  24. {
  25.     int n, i;
  26.     scanf("%d", &n);
  27.  
  28.     int array [n];
  29.     ler_array (array, 0);
  30.  
  31.     ordem_inversa (array, 0);
  32.     printf("%d", array);
  33.  
  34.     deslocamento_esquerda (array, 0);
  35.     printf("%d", array);
  36.  
  37.     ordem_decrescente (array, 0);
  38.     printf("%d", array);
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement