Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please need it now Draw the flowchart for this code? #include #include int main() { char gender[10], name[20], activity[20]; int weight; int height; int age;

please need it now

Draw the flowchart for this code? #include #include

int main() { char gender[10], name[20], activity[20]; int weight; int height; int age; float BMR, DCR, activitymul ; int activity_multiplier; printf("\t\t\t\t\t#WELCOME TO GROUB ONE PROJECT# "); printf(" Our system will calculate your Basal Metabolic Rate BMR and Daily Calorie Requirement "); printf(" DCR based on the details you will provide "); printf(" =================================================================================================="); printf(" Pleade provide the followwing details: "); printf(" Enter your name : "); scanf("%s", name); printf("Enter your weight (in kg) : "); scanf("%d", &weight); printf("Enter your height (in cm) : "); scanf("%d", &height); printf("Enter your age (in years) : "); scanf("%d", &age); printf("Enter your gender (male or female) : "); scanf("%s", gender); printf(" Choose your level of activity: "); printf(" 1. Sedentary 2. Lightly Active 3. Moderately Active 4. Very Active 5. Extremely Active "); scanf("%d", &activity_multiplier);

switch(activity_multiplier) { case 1: activitymul= 1.2; strcpy(activity,"Sedentary"); break; case 2: activitymul= 1.375; strcpy(activity,"Lightly Active"); break; case 3: activitymul= 1.55; strcpy(activity,"Moderately Active"); break; case 4: activitymul= 1.725; strcpy(activity,"Very Active"); break; case 5: activitymul= 1.9; strcpy(activity,"Extremely Active"); break; default: printf("Invalid input for activity level. "); return 1; }

if (strcmp(gender, "Male") == 0) { BMR = 66 + (13.7 * weight) + (5 * height) - (6.8 * age); } else if (strcmp(gender, "Female") == 0) { BMR = 655 + (9.6 * weight) + (1.8 * height) - (4.7 * age); } else { printf("Invalid input for gender. "); return 1; }

DCR = BMR * activitymul; printf(" \t\tHere is your result"); printf(" Name : %s ",name); printf(" Age : %d ", age); printf(" Weight : %d ", weight); printf(" Height : %d ", height); printf(" Gender : %c ", gender); printf(" Level of Activity : %s ",activity); printf(" BMR : %.0f ", BMR); printf(" DCR : %.0f ", DCR); printf("Note : Based on this calculation, you would need %.0f calories from food to sustain your daily activities. ", DCR);

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions