Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int product(int x, int y)
- {
- if (x < y)
- return product(y, x);
- else if (y != 0)
- return (x + product(x, y - 1));
- else
- return 0;
- }
- int produit( int a, int b)
- {
- if ( !a || !b ) return 0;
- if ( a == 1 ) return b;
- if ( b == 1 ) return a;
- return produit(a-1, b-1)+a+b-1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement