2.11BSD/share/learn/C/L14.2a
#print
Using the "getnum" routine on "getnum.o", write a program
that reads a list of positive numbers and prints their sum. Stop reading
numbers when "getnum" returns a negative or zero value.
Compile and test your program; then type "ready".
#once #create Ref
5 43 293 400 75 832 903 33
#once cp %s/getnum.o .
#user
a.out <Ref >xxx
grep 2584 xxx >/dev/null
#succeed
/* Read numbers and count */
main()
{
int s, n;
s = 0;
while ((n=getnum()) > 0)
s += n;
printf("Sum is %d\n", s);
}
#log
#next
14.2b 5
15.1a 10