ramontricolor12

LISTA 08 - Exercício 06

Aug 9th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. /*CABEÇALHO
  2.     Arquivo: LISTA 08 - Exercício 06.c
  3.     Objetivo: Realiza a transposição de três valores.
  4.     Autor(a): Ramon Borges.
  5. */
  6.  
  7. #include <stdio.h>
  8.  
  9. //PROTOTIPO DE FUNÇÕES
  10. void rodaUmaVez(int *x, int *y, int *z);
  11.  
  12. int main()
  13. {
  14.     int a, b, c;
  15.     printf("Informe 3 valores inteiros: ");
  16.     scanf("%d %d %d", &a, &b, &c);
  17.     rodaUmaVez(&a,&b,&c);
  18.     printf("%d %d %d", a, b, c);
  19.     return 0;
  20. }
  21.  
  22. void rodaUmaVez(int *x, int *y, int *z)
  23. {
  24.     int aux;
  25.     aux = *x;
  26.     *x = *y;
  27.     *y = *z;
  28.     *z = aux;
  29.     return;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment