COMS 3101-3: Programming Languages (C)

Download putty from You may have to enter your uni and password to download it.

Goto Programs → Putty → Cunix.

Enter your uni for login and then enter your password. Once you login, you will see a $ on the left of your screen.

Create or make a directory called testdir by typing:

mkdir testdir

Change the current directory to testdir by typing:

cd testdir

Now open a file sum.c with the emacs editor

emacs sum.c

Type in your program


        int x, y, z;
        printf ("Enter the value of x: ");
        scanf ("%d", &x);
        printf ("Enter the value of y: ");
        scanf ("%d", &y);
        z = x + y;
        printf ("The sum is %d\n", z);

Save the program using

Ctr-x Ctr-s

Exit from the editor using

Ctr-x Ctr-c

You should now see the $ sign (may appear on the bottom-left of your screen).

Now compile your program by typing

gcc -o sum sum.c

And then run your program by typing


For more information on emacs, see

Happy Programming!