C Programming

Answers to Practise Exercise 1: Defining Variables

1. Declare an integer called sum


	int sum;

2. Declare a character called letter


	char letter;

3. Define a constant called TRUE which has a value of 1


	#define TRUE 1

4. Declare a variable called money which can be used to hold currency


	float money;

5. Declare a variable called arctan which will hold scientific notation values (+e)


	double arctan;

6. Declare an integer variable called total and initialise it to zero.


	int total;
	total = 0;

7. Declare a variable called loop, which can hold an integer value.


	int loop;

8. Define a constant called GST with a value of .125


	#define GST 0.125


©Copyright B Brown. 1984-1999. All rights reserved.