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 s = a + b + c + d;
- if (15 <= s && s <= 24) return TRUE;
- return FALSE;
- }
- int odd(int a, int b, int c, int d) {
- int o = (a % 2 == 0) + (b % 2 == 0) + (c % 2 == 0) + (d % 2 == 0);
- if (o == 1 || o == 2) return TRUE;
- return FALSE;
- }
- int small(int a, int b, int c, int d) {
- int s = (a < 5) + (b < 5) + (c < 5) + (d < 5);
- if (s == 2 || s == 3) return TRUE;
- return FALSE;
- }
- int main(void) {
- int a, b, c, d;
- for (a = 0; a < 10; a++)
- for (b = a + 1; b < 10; b++)
- for (c = b + 1; c < 10; c++)
- for (d = c + 1; d < 10; d++)
- if (sum(a, b, c, d) && odd(a, b, c, d) && small(a, b, c, d))
- printf("%d %d %d %d\n", a, b, c, d);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement