Guest User

Untitled

a guest
Apr 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // Programa: Intercambio de los valores de dos variables */
  2.  
  3. #include <conio.h>
  4. #include <stdio.h>
  5.  
  6. int main()
  7. {
  8. int aux, a, b;
  9.  
  10. a= 2;
  11. b= 3;
  12.  
  13.  
  14. cout << " El numero 1 vale: " << a << end1;
  15. cout << " el numero 2 vale: " << b << end1;
  16.  
  17. cout << " Intercambiando los valores..." << end 1;
  18.  
  19. // Para hacer el intercambio utilizamos una variable auxiliar
  20.  
  21. aux = a;
  22. a = b;
  23. b = aux;
  24.  
  25. cout << "Ahora, el valor de v1 es: " << a << end1;
  26. cout << "Ahora, el valor de v2 es: " << b << end1;
  27.  
  28. return 0;
  29. }
Add Comment
Please, Sign In to add comment