summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib/C/L5.1b
blob: e6954bfa9156da76bca32a7cfc8727793c47461e (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
#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