Advertisement
Josif_tepe

Untitled

Apr 23rd, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int funckija(int a, int b, char znak) {
  5.     int answer = 0;
  6.     if(znak == '+') {
  7.         answer = a + b;
  8.     }
  9.     else if(znak == '-') {
  10.         answer = a - b;
  11.     }
  12.     return answer;
  13. }
  14. int main() {
  15.     int n, m;
  16.     cin >> n >> m;
  17.     cout << funckija(n, m, '+') << endl;
  18.     cout << funckija(n, m, '-') << endl;
  19.    return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement