Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

16. Training Heart Rate In order for exercise to be beneficial to the cardiovasc

ID: 3775653 • Letter: 1

Question

16. Training Heart Rate

In order for exercise to be beneficial to the cardiovascular system, the heart rate (number of heart beats per minute) must exceed a value called the training heart rate, THR. A person's THR can be calculated from his or her age and resting heart rate (pulse rate when first awakening as follows:

(a) Calculate the maximun heart rate as 220 - age.
(b) Subtract the resting heart rate from the naximum heart rate.
(c) Multiply the result in step (b) by 60%, and then add the resting heart rate.

Write a program to request a person's age and resting heart rate as input and display his or her THR. Must use user defined functions.

Explanation / Answer

#include<stdio.h>
#include<stdlib.h>

float thr(int age, int rate);

int main(){
  
    int age=0;
    int rate=0;
    float t;
    printf("Enter the age");
    scanf("%d",&age);
    printf("Enter the resting heart rate");
    scanf("%d",&rate);
    t=thr(age,rate);  
    printf("The training heart rate =%f ",t);
  
  
}

float thr(age,rate){


    int maxhr, h, hr;
    maxhr=220-age;
    hr=maxhr-rate;
    h=(hr*0.6)+rate;
    return h;
  
}

Example:

Enter the age23
Enter the resting heart rate123
The training heart rate =167.000000

Enter the age34
Enter the resting heart rate90
The training heart rate =147.000000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote