Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int multiply (int a, int b)
- {
- if (b == 1) return a;
- return a + multiply(a, b-1);
- }
- int check(int i=1)
- {
- int a, b;
- scanf("%d", &a);
- if (a == 0)
- return 0;
- b = check (i + 1);
- if (i%2 == 0)
- return a+b;
- else
- return multiply (a,b);
- }
- int add_or_multiply()
- {
- return check();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement