Homework1-2 - */ miles; /* output - distance in miles */ /*...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #1 /* * Program: HW1_2.c * Written by Justin Waters * Inputs: distance in kilometers * Outputs: distance in miles * Description: Converts distance in kilometers to miles. */ #include <stdio.h> /* printf, scanf definitions */ #define MILES_PER_KM 0.6215 /* conversion constant */ int main(void) { double kms, /* input - distance in kilometers.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ miles; /* output - distance in miles */ /* Get the distance in kilometers. */ printf("Enter the distance in kilometers> "); scanf("%lf", &kms); /* Convert the distance to miles. */ miles = MILES_PER_KM * kms; /* Display the distance in miles. */ printf("That equals %f miles.\n", miles); return (0); }...
View Full Document

This note was uploaded on 08/06/2008 for the course EGR 261 taught by Professor Parikh during the Spring '08 term at Grand Valley State University.

Ask a homework question - tutors are online