Programming Fundamentals
Information
- This page contains additional revision exercises for week 01.
- These exercises are not compulsory, nor do they provide any marks in the course.
- You cannot submit any of these exercises, however autotests may be available for some them (Command included at bottom of each exercise if applicable).
Exercise — individual:
Print a Simple Diamond
Create a program simple_diamond.c that prints a simple diamond shape that
uses / and \ for the outline.
Examples
dcc simple_diamond.c -o simple_diamond ./simple_diamond /\ \/
When you think your program is working,
you can use autotest
to run some simple automated tests:
1511 autotest simple_diamond
Exercise — individual:
Print a Simple Triangle
Create a program called simple_triangle.c which prints a triangle.
Examples
dcc simple_triangle.c -o simple_triangle
./simple_triangle
^
/ \
/ \
/ \
/_______\
When you think your program is working,
you can use autotest
to run some simple automated tests:
1511 autotest simple_triangle