construct c program flow chart
#include <stdio.h>
#include <math.h>
#include <string.h>
#define num 6
#define b 6
#define t 6
double bmical(double w, double h){
double o;
double bmi;
o = pow(h,2);
bmi = w/o;
return bmi;
}
double maxheartrate(int num1, int age){
double mhr;
mhr = num1 - age;
return mhr;
}
double heartratereserve(double mhr, double rhr){
double hrr;
hrr = mhr - rhr;
return hrr;
}
double minrange(int hrr, int rhr){
double mirt;
mirt = (hrr * 0.7) + rhr;
return mirt;
}
double maxrange(int hrr, int rhr){
double mart;
mart = (hrr * 0.85) + rhr;
return mart;
}
int main() {
printf("Online Application for Sports Teacher's Position
2019\n\n");
char N[90];
int A;
double P;
char E[20];
char grade;
double score;
char G;
double S;
int count;
double g;
double total;
double cgpa;
double h;
double w;
double bmi;
double hbpm;
int n = 220;
int mark[10];
int sum;
int average;
int i;
int marks[10];
int ave;
int s;
int tot;
printf("Name: ");
scanf("%s%s%s", &N,&N,&N);
printf("Phone number: ");
scanf("%lf", &P);
printf("Email address: ");
scanf("%s", &E);
printf("Age: ");
scanf("%d", &A);
if(A>=21&&A<=26){
printf("You are qualified!\n\n");
}
else if(A<21){
printf("You are not qualified!\n\n");
return 0;
}
else if (A>26) {
printf("You are not qualified!\n\n");
return 0;
}
printf("----------------------------------------------
\n\n");
printf("Enter your Sport Science Grade [A,B,C,D,F]: ");
scanf("%s", &grade);
if(grade == 'A')
score = 4.0;
else if(grade == 'B')
score = 3.0;
else if(grade == 'C')
score = 2.0;
else if(grade == 'D')
score = 1.0;
else if(grade == 'F')
score = 0.0;
else {
score = -1;
printf("Invalid grade '%c'\n", grade);
}
if(score != -1)
printf("Your score is %.2f\n", score);
if(score>=2&&score<=4){
printf("You are qualified!\n\n");
}
else if(score<1){
printf("You are not qualified!\n\n");
return 0;
}
printf("Enter your English grade [A,B,C,D,F]: ");
scanf("%s", &G);
switch(G){
case'A':
S = 4.0;
break;
case 'B':
S = 3.0;
break;
case 'C':
S = 2.0;
break;
case 'D':
S = 1.0;
break;
case 'F':
S = 0.0;
break;
default:
S = -1;
printf("Invalid grade '%c'\n", G);
break;
}
if(S !=-1)
printf("Your score is %.2f\n", S);
if(S>=2&&S<=4){
printf("You are qualified!\n\n");
}
else if(S<1){
printf("You are not qualified!\n\n");
return 0;
}
count = 0;
total = 0;
while(count < num){
printf("Enter you GPA each sem: ");
scanf("%lf", &g);
total += g;
count++;
}
cgpa = total/num;
printf("Your CGPA is: %.2f\n", cgpa);
if(cgpa>=2.5&&cgpa<=4){
printf("You are qualified!\n\n");
}
else if(cgpa<2.5){
printf("You are not qualified!\n\n");
return 0;
}
for(i=0; i< b; ++i)
{
printf("Enter your 'Fitness Test' mark for each sem: ");
scanf("%d", &mark[i]);
sum += mark[i];
}
average = sum/b;
printf("Average marks = %d\n\n", average);
if(average < 12){
printf("You are not qualified!\n\n");
return 0;
}
else if(average>=12&&average<=20){
printf("You are qualified!\n\n");
}
else if (average>=21) {
printf("Invalid, please enter correctly!\n\n");
return 0;
}
for(s=0; s< t; ++s)
{
printf("Enter your 'Bleep Test' mark for each sem: ");
scanf("%d", &marks[s]);
tot += marks[s];
}
ave = tot/t;
printf("Average marks = %d\n\n", ave);
if(ave<5.0){
printf("You are not qualified!\n\n");
return 0;
}
else{
printf("You are qualified!\n\n");
}
printf("----------------------------\n\n");
printf("Enter your weight (kg): ");
scanf("%lf", &w);
printf("Enter your height (m): ");
scanf("%lf", &h);
bmi = bmical(w,h);
printf("Your BMI is %.2f\n\n", bmi);
if(bmi < 18.5){
printf("You are underweight!\n");
}
else if(bmi>=18.5&&bmi<=24.9){
printf("You are healthy!\n");
}
else if(bmi>=25&&bmi<=29.9){
printf("You are overweight!\n");
}
else{
printf("You are obese!\n");
}
if(bmi < 18.5){
printf("You are not qualified!\n\n");
return 0;
}
else if(bmi>=18.5&&bmi<=24.9){
printf("You are qualified!\n\n");
}
else if (bmi>=25) {
printf("You are not qualified!\n\n");
return 0;
}
printf("-----------------------------------------------------------\n\n");
printf("Enter your heart beats per min when you are at rest:
");
scanf("%lf", &hbpm);
if(hbpm < 40){
printf("You are not qualified!\n\n");
return 0;
}
else if(hbpm>=40&&hbpm<=100){
printf("You are qualified!\n\n");
}
else if (hbpm > 100) {
printf("You are not qualified!\n\n");
return 0;
}
int res = maxheartrate(n, A);
printf("Maximum heart rate = %d\n\n", res);
printf("'Resting heart rate = Heart beats per min when you are
at rest' \n");
int res1 = heartratereserve(res, hbpm);
printf("Heart Rate reserve (HRR) = %d\n\n" , res1);
double res2 = minrange(res1, hbpm);
printf("Mininum range target heart zone is %.2f\n" ,
res2);
double res3 = maxrange(res1, hbpm);
printf("Maximum range target heart zone is %.2f\n\n" ,
res3);
printf("Average target heart rate zone for exercise intensity;
\n");
printf("Moderate exercise intensity: %.2f\n", res2);
printf("Vigorous exercise intensity: %.2f\n", res3);
printf("------------------------------------------------------------------------\n\n");
printf("Congratulations! You are shortlisted for Sports
Teacher's Position 2019.\n");
printf("Results will be announced next week via email, Thank
You!\n\n");
return 0;
}