forgot to commit this

This commit is contained in:
SowinskiBraeden committed 2025-10-26 12:51:57 -07:00
1 parent 6a53c86e8f
commit f63842d487
14 files changed
+353 -20

No files matched your search

+31 -6
View File
@@ -1,26 +1,51 @@
#include <stdio.h>
/*
* Course: COMP 2510
* Assignment: Assignment 1
* Name: Braeden Sowinski
* Student ID: A01385066
* Date: 2025-09-20
* Description: Convert centimeters to feet and inches
*/
#define CENTIMETERS_PER_FOOT 30.48
#define CENTIMETERS_PER_INCH 2.54
#define INCHES_PER_FOOT 12
int main(void) {
/**
* main program entry
*
* continuously takes user input for a height
* in centimeters and then converts that to
* feet and inches with proper amount of decimal
* points.
*
* Quits when a number less than or equal to 0
* is inputed.
*/
int main(void)
{
float heightCm;
int heightFeet;
float heightInches;
do {
do
{
printf("Enter a height in centimeters (<=0 to quit): ");
scanf("%f", &heightCm);
if (heightCm <= 0) {
if (heightCm <= 0)
{
break;
}
heightFeet = (heightCm / CENTIMETERS_PER_FOOT);
heightInches = (heightCm / CENTIMETERS_PER_INCH) -
heightInches = (heightCm / CENTIMETERS_PER_INCH) -
(INCHES_PER_FOOT * heightFeet);
printf(
@@ -35,4 +60,4 @@ int main(void) {
printf("Bye\n");
return 0;
}
}