Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project age estimate #1

Open
serah100 opened this issue Mar 31, 2023 · 0 comments
Open

Project age estimate #1

serah100 opened this issue Mar 31, 2023 · 0 comments

Comments

@serah100
Copy link

serah100 commented Mar 31, 2023

#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;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant