Advertisement
JosepRivaille

X51086: Funció per la diferència de dos nombres

Mar 14th, 2015
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. //Pre: Llegeix dos nombres
  5. //Post: La funció en calcula la diferencia
  6. int dif(int x, int y) {
  7.     int d;
  8.     d = x - y;
  9.     return d;
  10. }
  11.  
  12. int main() {
  13.     int x, y;
  14.     cin >> x >> y;
  15.     cout << dif(x, y) << endl;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement