summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib/C/L5.2a
blob: 060e29c41b094329cfe5f14dd0bb26b66a110051 (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
#print
Write a program which reads a character from its
input and prints "high" if that character is
larger than 100 in numeric value (decimal) and "low"
if it is less than or equal to 100 in numeric value.
Compile it as usual and then type "ready".
#once #create Ref1
u is a big letter
#once #create Ref2
B is a small letter
#user
a.out <Ref1 >test1
a.out <Ref2 >test2
grep high test1 >/dev/null && grep low test2 >/dev/null 
#succeed
One way:

main()
{
	if (getchar() > 100)
		printf("high\n");
	else
		printf("low\n");
}
#log
#next
5.1b 10