IntroSampleProgram - Introduction to C Sample Programming...

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/25/2010 for the course COMPUTER S COP3223 taught by Professor Lobo during the Spring '10 term at University of Central Florida.

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 Right Arrow Icon
Ask a homework question - tutors are online