Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Projects: Variables (c)

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


Project 1

Use short and long integers to make the calculations in this program. Print this on the screen:

Enter a number between 1 and 20:
Enter a number between 555000 and 777000:

(viewer's second number) times (viewer's first number) is (result).


Project 2

Use double floats to make the calculations in this program. The planet Uranus has an elliptical orbit around the Sun:

  • nearest to the Sun: 2.74 x 10 9 km
  • farthest from the Sun: 3.00 x 10 9 km

Calculate the average distance of Uranus from the Sun.

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

1