BSD 4_3 development
[unix-history] / usr / lib / learn / C / L11.1a
CommitLineData
2e8921b7
C
1#print
2With your 'cc' command you can give the name of
3an object file to be loaded with your program.
4For example
5 cc x.c y.o
6will load the previously compiled program 'y' along with
7the program 'x' to be compiled now.
8
9The file "getnum.o" contains a subroutine "getnum" which
10reads an integer and returns its value.
11Write a program which reads a number and decides
12whether or not it is a multiple of 23. If so print
13"yes" and otherwise print "no".
14Compile and test; then type "ready".
15#once #create Ref1
1623000
17#once #create Ref2
1823001
19#once cp %s/getnum.o .
20#user
21a.out <Ref1 >z1
22a.out <Ref2 >z2
23grep yes z1 >/dev/null || grep no z2 >/dev/null
24#succeed
25/* One way: */
26
27main() {
28 if (getnum()%23 == 0)
29 printf("yes\n");
30 else
31 printf("no\n");
32}
33#log
34#next
3512.1a 10