diff options
Diffstat (limited to 'usr.bin/learn/lib/C/L5.1b')
-rw-r--r-- | usr.bin/learn/lib/C/L5.1b | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/usr.bin/learn/lib/C/L5.1b b/usr.bin/learn/lib/C/L5.1b new file mode 100644 index 00000000000..e6954bfa915 --- /dev/null +++ b/usr.bin/learn/lib/C/L5.1b @@ -0,0 +1,25 @@ +#print +(Section 1.5) +Write a program that will read the first character +from its input and print it out in octal. +Compile it, test it, and then type ready. +#once #create Ref ++ +#user +a.out <Ref >test +grep 53 test >/dev/null +#succeed +A possible solution: + +main() +{ + printf("%o\n", getchar()); +} + + Remember that you can use a function value almost + any place that you could use a variable like x. + Thus many times there's no need for extra variables. +#log +#next +5.1c 10 +5.2b 5 |