Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- int n;
- scanf("%d", &n);
- int a[n];
- for (int i = 0; i < n; i++)
- {
- scanf("%d", &a[i]);
- }
- int b[n];
- for (int i = 0; i < n; i++)
- {
- scanf("%d", &b[i]);
- }
- int res = 0;
- for(int i = 0; i < n; i++)
- {
- if (a[i] > b[i])
- res += a[i];
- else if (b[i] > a[i])
- res += b[i];
- else if (b[i] == a[i])
- res += b[i];
- }
- printf("%d", res);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement