The links below provide examples of C programs to do simple tasks, in each case, there is a web page describing the progtram and the C source code - which you may like to compile yourself.
To provide an example of an assembly language program, an assembly language source file is available which configures a parallel I/O port to act as a counter. The assembly language program is for the PIC microcontroller.