ELE209 Lab 8 Introduction to C Language Programming April 8/10

advertisement
ELE209 Lab 8
Introduction to C Language Programming
April 8/10, 2013
Due: You must email your code to TA and demonstrate it by the end of lab on April 15/17.
Goal: To introduce you to writing, compiling, and executing programs written in the C language.
1. Type in, compile, and execute the example program shown in Figure 11.3 of the text (it is also on the
back of this sheet). Make sure that it is proplerly formatted and commented, and be sure to add your
name to the header comment.
Demonstrate it to the TA from both the Linux command line and the LC-3 console.
2. Modify the program from the previous problem so that it prompts the user to enter a character and
then prints every character from that character down to the “!” character in the order they appear in
the ASCII table. Your program should print one character per line.
Demonstrate it to the TA from both the Linux command line and the LC-3 console.
3. Write a C program that asks for two integers, one at a time, multiplies them, then prints the result on
its own line.
Demonstrate it to the TA from both the Linux command line and the LC-3 console.
Note:
To compile the program file.c for Linux, run
gcc -o file file.c
To compile it for the LC-3, run
lcc -o file file.c
Download