Advertisement
Razija

Untitled

Feb 25th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int f(int x, int y){
  4. if(x<y)
  5. return f(y,x);
  6. else if(y!=0)
  7. return(x+f(x,y-1));
  8. else
  9. return 0;
  10. }
  11.  
  12. int main(){
  13. int x, y;
  14. cin>>x>>y;
  15. cout<<f(x,y);
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement