Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Projects: Variables (a)

Instructions: Create a C program that runs successfully for each project below.


Project 1

Using an integer variable for 1960, create a C program that prints this on the screen:

Most West African nations achieved independence in 1960.


Project 2

Let's find out when the viewer's country achieved independence. Use an integer variable, ask the viewer a question, scan the answer, then print this on the screen:

What year did your country achieve independence?
Your country was born in (put the viewer's answer here).


Project 3

Now calculate how old the viewer's country is. Add another variable and a calculation to the previous C program and print this on the screen:

What year did your country achieve independence?
Your country is (put the viewer's answer here) years old.

Copyright
© 2001
Kristin Switala
Hosted by www.Geocities.ws

1