SAMPLE EXECUTIONS OF ALL PROGRAMS
Program 1:
vetsikas@snoball: [17] ~/113/2/q1 > q21sol
5 4 5 <input
# \
output starts
## |
### |
####
#####
####
#####
####
#####
####
#####
####
#####
####
###
## |
# /
end of output
vetsikas@snoball: [19] ~/113/2/q1 > q21sol
1 1 1 <input
# <output
Program 2:
1 <input
N=1 \ output starts
1/1
--- / end of output
2 <input
N=2 \ output starts
1/2
1/1
--- / end of output
3 <input
N=3 \ output starts
1/3
1/2
2/3
1/1
--- / end of output
4 <input
N=4 \ output starts
1/4
1/3
1/2
2/3
3/4
1/1
--- / end of output
5 <input
N=5 \ output starts
1/5
1/4
1/3
2/5
1/2
3/5
2/3
3/4
4/5
1/1
--- / end of output
6 <input
N=6 \ output starts
1/6
1/5
1/4
1/3
2/5
1/2
3/5
2/3
3/4
4/5
5/6
1/1
--- / end of output
0 <input
Thus the printf commands that you use should be:
printf("%d/%d\n", a1, a2); to print the first line of the output
printf("%d/%d\n", x, y); to print a fraction of x/y
printf("---\n"); to print the last line of the output
Program 3:
vetsikas@snoball: [27] ~/113/2/q3 > q23sol
5
<input
NHILAT
<input
MOTHER
<output
ghdfkjs / FHR
<input
ghdfkjs / DOG
<output
<input
<output
...G VN V OIDFAMI... <input
...I AM A STUDENT... <output
ILA SVOI SGMA
<input
THE LAST LINE
<output