/* convert5.c This program converts an integer greater than 100 but less than 1000 given by the user from the English unit of measure, inches, to the Metric System units; cm, m, and km. If the input is not between 100 and 1000, the user is prompted for correct input. This program will run until valid input is given. This program may not reflect all the requirements of the C Coding Standards used in this class. */ #include <stdio.h> int main() { int inches; float meters; printf("This program will convert inches into the Metric System.\n"); do { printf("Please enter an inetger between 100 and 1000: "); scanf("%d", &inches); } while (inches < 100 || inches > 1000); meters = inches * .0254; printf("\t\t%.1f centimeters\n", meters * 100); printf("\t\t%.1f meters\n", meters); printf("\t\t%.1f kilometers\n", meters / 1000); return(0); }


[foxtrot]> cc convert5.c [foxtrot]> a.out This program will convert inches into the Metric System. Please enter an inetger between 100 and 1000: 13 Please enter an inetger between 100 and 1000: 36 Please enter an inetger between 100 and 1000: 3456 Please enter an inetger between 100 and 1000: 345 876.3 centimeters 8.8 meters 0.0 kilometers [foxtrot]>