The purpose of this assignment is to get you familiar with the Unix environment -- emacs and gcc in particular -- and with input and output in C.

  1. Log into your Unix account on tanner. In your csc2400 directory, create another directory called scanfprintf.

  2. Change your current directory to csc2400/scanfprintf. Invoke the emacs editor to write a program called digitsum.c for exercise 9, page 43 from your textbook:
         emacs digitsum.c
    
    Here is all you need about printf and scanf in C. Remember to save your code frequently with CTRL-X CTRL-S, use CTRL-G when stuck in the editor, and CTRL-X CTRL-C to exit the editor.

  3. To compile your code, use the command
         gcc digitsum.c -o digitsum
    
    Pay careful attention to error and warning messages, and eliminate them all. To execute your program, use the command
        ./digitsum
    

  4. Turn in a printout copy of your code. (You will need to copy and paste your code into a text or a Word document in Windows, since you cannot print it directly from Unix.) Good luck!