Project age estimate
serah100 opened this issue · 0 comments
serah100 commented
#include <stdio.h>
int main() {
int father_height, mother_height;
char gender;
float predicted_height;
printf("Enter the height of the father (in inches): ");
scanf("%d", &father_height);
printf("Enter the height of the mother (in inches): ");
scanf("%d", &mother_height);
printf("Enter the gender of the child (M/F): ");
scanf(" %c", &gender);
predicted_height = (father_height + mother_height) / 2.0;
if (gender == 'M') {
predicted_height += 2.5;
} else if (gender == 'F') {
predicted_height -= 2.5;
} else {
printf("Invalid gender input\n");
return 1;
}
printf("Predicted height of the child: %.2f inches\n", predicted_height);
return 0;
}