equal
deleted
inserted
replaced
|
1 /** |
|
2 * $Id: max.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $ |
|
3 * $Source: /development/c/demos/max.c,v $ |
|
4 * |
|
5 */ |
|
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]); |
|
21 return EXIT_SUCCESS; |
|
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 } |