The following challenge asks you to apply what you havelearned during the 1st ma
ID: 3615299 • Letter: T
Question
The following challenge asks you to apply what you havelearned during the 1st marking period. One might say this is anexcellent way for you to measure your progress to this point. So,here is your assignment description:Estimating the Adult Height of a Child
Hmale_child = ((Hmother x 13/12) + Hfather)/2
Hfemale_child = ((Hfather x 12/13) + Hmother)/2
Part II - Program B (Program A modified)
The program should allow the user to enter a new set of values andoutput the predicted height UNTIL the user decides to exit (Hint:Sentinel). The user should be able to input the heights in feet andinches, and the program should output the estimated height of thechild in feet and inches. Use the int data type to store theheights.
The following challenge asks you to apply what you havelearned during the 1st marking period. One might say this is anexcellent way for you to measure your progress to this point. So,here is your assignment description:
Estimating the Adult Height of a Child
Hmale_child = ((Hmother x 13/12) + Hfather)/2
Hfemale_child = ((Hfather x 12/13) + Hmother)/2
Part II - Program B (Program A modified)
The program should allow the user to enter a new set of values andoutput the predicted height UNTIL the user decides to exit (Hint:Sentinel). The user should be able to input the heights in feet andinches, and the program should output the estimated height of thechild in feet and inches. Use the int data type to store theheights.
Explanation / Answer
//Hope this will helpyou.//part b.
#include <stdio.h> #include <string.h> #include<stdlib.h>
int main() { int feetm,inchesm; double Hmother,Hfather,Hmale_child,Hfemale_child; int feetf,inchesf; char ch; while(1){ printf("Enter mothter height in feet and inches:"); scanf("%d %d",&feetm,&inchesm);
Hmother = feetm*12 + inchesm; printf("Enter father's height in feet and inches:"); scanf("%d %d",&feetf,&inchesf);
Hfather = feetf*12 + inchesf;
Hmale_child = (( Hmother * 13/12) + Hfather)/2;
Hfemale_child = ((Hfather * 12/13) + Hmother)/2 ; Hmale_child /=12; Hfemale_child /=12; printf("Height of male is :%lf feet ",Hmale_child); printf("Height of female is :%lf feet ",Hfemale_child); printf(" Do you want to continue?");
do { ch=getchar(); }while(ch!='y'&& ch !='Y' && ch !='n'&& ch !='N'); if(ch=='y'||ch=='Y') continue; else break; } system("pause"); return 0; }
#include <stdio.h> #include <string.h> #include<stdlib.h>
int main() { int feetm,inchesm; double Hmother,Hfather,Hmale_child,Hfemale_child; int feetf,inchesf; char ch; while(1){ printf("Enter mothter height in feet and inches:"); scanf("%d %d",&feetm,&inchesm);
Hmother = feetm*12 + inchesm; printf("Enter father's height in feet and inches:"); scanf("%d %d",&feetf,&inchesf);
Hfather = feetf*12 + inchesf;
Hmale_child = (( Hmother * 13/12) + Hfather)/2;
Hfemale_child = ((Hfather * 12/13) + Hmother)/2 ; Hmale_child /=12; Hfemale_child /=12; printf("Height of male is :%lf feet ",Hmale_child); printf("Height of female is :%lf feet ",Hfemale_child); printf(" Do you want to continue?");
do { ch=getchar(); }while(ch!='y'&& ch !='Y' && ch !='n'&& ch !='N'); if(ch=='y'||ch=='Y') continue; else break; } system("pause"); return 0; }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.