complete assignment01

This commit is contained in:
SowinskiBraeden committed 2025-09-20 16:19:53 -07:00
1 parent 3b82537781
commit 964dd99acf
5 files changed
+187

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#include <stdio.h>
#define CENTIMETERS_PER_FOOT 30.48
#define CENTIMETERS_PER_INCH 2.54
#define INCHES_PER_FOOT 12
int main(void) {
float heightCm;
int heightFeet;
float heightInches;
do {
printf("Enter a height in centimeters (<=0 to quit): ");
scanf("%f", &heightCm);
if (heightCm <= 0) {
break;
}
heightFeet = (heightCm / CENTIMETERS_PER_FOOT);
heightInches = (heightCm / CENTIMETERS_PER_INCH) -
(INCHES_PER_FOOT * heightFeet);
printf(
"%.1f cm = %d feet, %.1f inches\n",
heightCm,
heightFeet,
heightInches
);
} while (heightCm > 0);
printf("Bye\n");
return 0;
}