Lecture 3 - Arithmetic Operations

Back to Previous Lecture
Up to Main Page
Forward to Next Lecture

Arithmetic Operations

The program arith.c shows you how to perform a variety of arithmetic operations. It asks the user for two integer numbers, then adds, subtracts, multiplies and divides them, as well as uses the modulo operation.

Get Information From The User - New Version

The program getinfo.c from the pervious lecture has been improved here by adding our own include file which defines the maximum size for the name fields. We can change the size in the include file, then recompile the program and not have to change the actual source file. This is often handy when you have a lot of references to certain values that may change over the lifetime of the program.

Introducing Functions

The program getint.c is a modification of the getinfo program from above. It introduces a user defined function, get_int, that gets an integer value from the user.

Back to Previous Lecture
Up to Main Page
Forward to Next Lecture