Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int f(int x, int y){
- if(x<y)
- return f(y,x);
- else if(y!=0)
- return(x+f(x,y-1));
- else
- return 0;
- }
- int main(){
- int x, y;
- cin>>x>>y;
- cout<<f(x,y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement