BSD 4_3 development
[unix-history] / usr / lib / learn / C / L12.1a
#print
Write a program which reads two numbers and
prints the larger one in decimal. Use the same
"getnum" subroutine. Compile, test and type
"ready" as usual.
#once #create Ref1
14039 89
#once #create Ref2
20022 23001
#once cp %s/getnum.o .
#user
a.out <Ref1 >x1
a.out <Ref2 >x2
grep 14039 x1 >/dev/null || grep 23001 x2 >/dev/null
#succeed
/* One way: */
main() {
int n1, n2;
n1 = getnum();
n2 = getnum();
printf("%d\n", n1 > n2 ? n1 : n2);
}
/* You could also use something like
if (n1 > n2)
printf("%d\n", n1);
else
printf("%d\n", n2);
*/
#log
#next
12.1b 10