Create different versions of the program that: Calculates the user\'s age in min
ID: 3667724 • Letter: C
Question
Create different versions of the program that:
Calculates the user's age in minutes and seconds.
Estimates the approximate number of times the user's heart has beat in his/her lifetime using an average heart rate of 72 beats per minutes.
Estimates the number of times the person has sneezed in his/her lifetime (research on the Internet to obtain a daily estimate).
Estimates the number of calories that the person has expended in his/her lifetime (research on the Internet to obtain a daily estimate). Also calculate the number of sandwiches (or other common food item) that equals that number of calories.
Be creative: Pick other health-related statistic. Try searching the Internet to determine how to calculate that data, and create a program to perform that calculation. The program can ask the user to enter any information needed to perform the calculation.
Please use C language
#include <stdio.h>
int main(void) {
int userAgeYears = 0;
int userAgeDays = 0;
printf("Enter your age in years: ");
scanf("%d", &userAgeYears);
userAgeDays = userAgeYears * 365;
printf("You are %d days old. ", userAgeDays);
return 0;
}
Explanation / Answer
#include <stdio.h>
int main(void) {
int userAgeYears = 0;
int userAgeDays = 0;
double userAgeHours=0;
double userAgeMinute=0;
double userAgeSec =0;
double userAgeBeat=0;
double userLifesneeze=0;
double userLifecalo=0;
double usertotalSandwitches=0;
printf("Enter your age in years: ");
scanf("%d", &userAgeYears);
userAgeDays = userAgeYears * 365;
userAgeHours=userAgeDays*24;
userAgeMinutes=userAgeHours=userAgeHours*60;
userAgeSec=userAgeMinutes*60;
userAgeBeat=userAgeMinutes*72; // heart beat rate
userLifeSneeze=userAgeDays*4; // average sneeze in one day
userLifecalo=userAgeDays*1620; // average calories in one day
usertotalSandwitches=userLifecalo/233 ; // 233 calories in one sandwitch
printf("You are %d days old. ", userAgeDays);
printf("You are %lf Hours old. ", userAgeHours);
printf("You are %lf Minutes old. ", userAgeMinutes);
printf("You are %lf Seconds old. ", userAgeSec);
printf("Your heart beat total %lf . ", userAgeBeats);
printf("Your Lifetime Sneeze total is%lf . ", userLifesneeze);
printf("You LifeTime calories expences total is %lf . ", userAgecalo);
printf("You need %lf Sandwitches for life time calorie requirement . ", usertotalSandwitches);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.