/* * File: cm2ft.c * ---------------- * This program reads in a length given in centimeters and converts * it to its English equivalent in feet and inches. * * Modified from "cmtofeet.c" by Jeff Tian to illustrate the use * of integer "/" and "%" operators. -- 9/10/98 */ #include #include "genlib.h" #include "simpio.h" main() { int totalInches, cm, inch, feet; printf("This program converts centimeters to feet and inches.\n"); printf("Length in centimeters? "); cm = GetInteger(); totalInches = cm / 2.54; feet = totalInches / 12; inch = totalInches % 12; printf("%d cm = %d ft %d in\n", cm, feet, inch); }