/********************************************************* * From C PROGRAMMING: A MODERN APPROACH, Second Edition * * By K. N. King * * Copyright (c) 2008, 1996 W. W. Norton & Company, Inc. * * All rights reserved. * * This program may be freely distributed for class use, * * provided that this copyright notice is retained. * *********************************************************/ /* dweight.c (Chapter 2, page 20) */ /* Computes the dimensional weight of a 12" x 10" x 8" box */ #include int main(void) { int height, length, width, volume, weight; height = 8; length = 12; width = 10; volume = height * length * width; weight = (volume + 165) / 166; printf("Dimensions: %dx%dx%d\n", length, width, height); printf("Volume (cubic inches): %d\n", volume); printf("Dimensional weight (pounds): %d\n", weight); return 0; }