author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Thu, 16 Apr 2009 12:49:13 +0200 | |
changeset 57 | 7739518acafb |
parent 48 | b94d657a9acb |
child 61 | 4b4c97f179da |
permissions | -rw-r--r-- |
0 | 1 |
/** |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
2 |
* test/demos/max.c |
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) { |
|
20 |
printf ("Usage: %s value1 value2\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 |
} |