blob: ad51d56c842bb3c5b395a03855c620006eb55fb7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#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
|