Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define TRUE (1)
- #define FALSE !TRUE
- int sum(int a, int b, int c, int d, int e) {
- int s = a + b + c + d + e;
- if (60 <= s && s <= 100) return TRUE;
- return FALSE;
- }
- int even(int a, int b, int c, int d, int e) {
- int r = (a % 2 == 0) + (b % 2 == 0) + (c % 2 == 0) + (d % 2 == 0) + (e % 2 == 0);
- if (r == 2 || r == 3) return TRUE;
- return FALSE;
- }
- int small(int a, int b, int c, int d, int e) {
- int s = (a < 16) + (b < 16) + (c < 16) + (d < 16) + (e < 16);
- if (s == 2 || s == 3) return TRUE;
- return FALSE;
- }
- int main(void) {
- int a[] = { 1 };
- int b[] = { 5, 3, 16, 28, 4, 9 };
- int c[] = { 14, 3, 15, 21, 31, 27 };
- int d[] = { 7, 10, 22, 23, 30, 24 };
- int e[] = { 12, 8, 18, 25, 19, 20, 9 };
- int *a0, *b0, *c0, *d0, *e0;
- for (a0 = a; a0 < a + sizeof(a) / sizeof(int); a0++)
- for (b0 = b; b0 < b + sizeof(b) / sizeof(int); b0++)
- for (c0 = c; c0 < c + sizeof(c) / sizeof(int); c0++)
- for (d0 = d; d0 < d + sizeof(d) / sizeof(int); d0++)
- for (e0 = e; e0 < e + sizeof(e) / sizeof(int); e0++)
- if (sum(*a0, *b0, *c0, *d0, *e0) && even(*a0, *b0, *c0, *d0, *e0) &&
- small(*a0, *b0, *c0, *d0, *e0))
- printf("%2d %2d %2d %2d %2d\n", *a0, *b0, *c0, *d0, *e0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement