Advertisement
blaucherry

2.1

Feb 18th, 2020
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. void Intercambia(double *x, double *y);
  5. void Intercambia (double *x, double *y)
  6. {
  7. double guardar= *x;
  8. *x=*y;
  9. *y=guardar;
  10. }
  11. int main ()
  12. {
  13. double Perro;
  14. double Gato;
  15. printf("Escriba el valor de Perro\n");
  16. scanf("%lf", &Perro);
  17. printf("Escriba el valor de Gato\n");
  18. scanf("%lf", &Gato);
  19.  
  20. printf("El primer valor de Perro es %0.2f\n", Perro);
  21. printf("El primer valor de Gato es %0.2f\n", Gato);
  22. Intercambia (&Perro, &Gato);
  23. printf("El nuevo valor de Perro es %0.2f\n", Perro);
  24. printf("El nuevo valor de Gato es %0.2f\n", Gato );
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement