{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

IntroSampleProgram

# IntroSampleProgram - Introduction to C Sample Programming...

This preview shows pages 1–2. Sign up to view the full content.

Introduction to C – Sample Programming Assignment #1 Objective 1. To give students practice at typing in, compiling and running a simple program. 2. To learn how to read in input from the user. 3. To learn how to use assignment statements and arithmetic expressions to make calculations. Problem: Approaching Trains Problem Imagine a two-way straight railway and two trains approaching each other from opposite directions. You need to compute how long (in minutes) would it take for these trains to come side by side. You will also compute how many miles each train travels till then. Write a program to read in the distance (in miles), speeds of the trains (in miles per hour), and output the time to meet (in miles and use 3 digits of precision after the decimal point for displaying it) and the distance traveled by each train (use 2 digits of precision). Input Specification 1. The distance (in miles) between the trains will be a positive integer.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

IntroSampleProgram - Introduction to C Sample Programming...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online