author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Thu, 16 Apr 2009 13:57:47 +0200 | |
changeset 87 | b2f1756c17ca |
parent 77 | 49e0babccb23 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
77 | 2 |
* max.c |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
3 |
* Copyright (C) 2008 Markus Broeker |
0 | 4 |
*/ |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
5 |
|
0 | 6 |
#include <stdio.h> |
7 |
#include <stdlib.h> |
|
8 |
||
9 |
unsigned int max (unsigned int a, unsigned int b) |
|
10 |
{ |
|
11 |
return (a * (a > b) + b * (b > a)); |
|
12 |
} |
|
13 |
||
14 |
int main (int argc, char **argv) |
|
15 |
{ |
|
16 |
unsigned int a; |
|
17 |
unsigned int b; |
|
18 |
||
19 |
if (argc != 3) { |
|
61
4b4c97f179da
Lazy BNF / EBNF Help Messages
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
48
diff
changeset
|
20 |
printf ("Usage: %s <integer> <integer>\n", argv[0]); |
48
b94d657a9acb
Policy Inonsistency on many files
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
29
diff
changeset
|
21 |
return EXIT_FAILURE; |
0 | 22 |
} |
23 |
a = atoi (argv[1]); |
|
24 |
b = atoi (argv[2]); |
|
25 |
||
26 |
printf ("%u\n", max (a, b)); |
|
27 |
||
28 |
return EXIT_SUCCESS; |
|
29 |
} |