/* * File: cmtofeet2.c * ---------------- * Version 2, using just integers. * * This program reads in a length given in centimeters and * converts it to its English equivalent in feet and inches. */ #include #include "genlib.h" #include "simpio.h" main() { int totalInches, cm, inch, feet; printf("This program converts cm to feet and inches.\n"); printf("Length in integer centimeters? "); cm = GetInteger(); totalInches = cm / 2.54; feet = totalInches / 12; inch = totalInches % 12 ; printf("%d cm = %d ft %d in\n", cm, feet, inch); }