summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib/C/L1.1b
blob: 93798736abb8c214f45d2f0af5c72a9056d4b43b (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
#print
(Section 1.1)
Now write a C program that prints two lines,
the first of which says "hello" and the second
"goodbye".  Don't forget those \n delimiters.
Compile and test it.  When satisfied,
type "ready".
#once #create Ref
hello
goodbye
#user
a.out >test
#cmp test Ref
#succeed
Here is one possible solution to compare against yours.

main()
{
	printf("hello\n");
	printf("goodbye\n");
}

You could also combine the two messages into one
call to printf, like

	printf("hello\ngoodbye\n");

but this is harder to read at a glance.
#log
#next
1.1c 10