Advertisement
Drowze

APC B 01 - Procedimentos - 03

Aug 20th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1.  /*Escreva um procedimento em linguagem C chamado TrocaInt que troca os valores de
  2. duas variáveis inteiras X e Y. */
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. void TrocaInt(int x, int y);
  8.  
  9. void main(){
  10.     int x, y;
  11.     printf("Digite x e y e trocarei eles de lugar\n");
  12.     printf("x: ");
  13.     scanf("%d",&x);
  14.     printf("y: ");
  15.     scanf("%d",&y);
  16.  
  17.     TrocaInt(x,y);
  18.  
  19.     system("Pause");
  20. }
  21.  
  22. void TrocaInt(int x, int y){
  23.     int aux;
  24.  
  25.     aux=x;
  26.     x=y;
  27.     y=aux;
  28.  
  29.     printf("\nx: %d\ny: %d",x,y);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement