Question

In: Computer Science

C-Language *Calculates the user's age in seconds. *Estimate the number of times the person has sneezed...

C-Language

*Calculates the user's age in seconds.

*Estimate 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.

Code template: C-Language

#include <stdio.h>
int main(void) {
   int userAgeYears;
   int userAgeDays;
   int userAgeMinutes;
   int totalHeartbeats;
   int avgBeatsPerMinute = 72;
   
   printf("Enter your age in years: ");
   scanf("%d", &userAgeYears);
   
   userAgeDays = userAgeYears * 365;               // Calculate days without leap years
   userAgeDays = userAgeDays + (userAgeYears / 4); // Add days for leap years
   
   printf("You are %d days old.\n", userAgeDays);
   
   userAgeMinutes = userAgeDays * 24 * 60;         // 24 hours/day, 60 minutes/hour
   printf("You are %d minutes old.\n", userAgeMinutes);   

   totalHeartbeats = userAgeMinutes * avgBeatsPerMinute;
   printf("Your heart has beat %d times.\n", totalHeartbeats);

   return 0;
}

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

#include <stdio.h>
int main(void) {
int userAgeYears;
int userAgeDays;
int userAgeMinutes;
int totalHeartbeats;
int avgBeatsPerMinute = 72;

printf("Enter your age in years: ");
scanf("%d", &userAgeYears);

userAgeDays = userAgeYears * 365; // Calculate days without leap years
userAgeDays = userAgeDays + (userAgeYears / 4); // Add days for leap years

printf("You are %d days old.\n", userAgeDays);

userAgeMinutes = userAgeDays * 24 * 60; // 24 hours/day, 60 minutes/hour
printf("You are %d minutes old.\n", userAgeMinutes);

totalHeartbeats = userAgeMinutes * avgBeatsPerMinute;
printf("Your heart has beat %d times.\n", totalHeartbeats);
int sneeze=4*userAgeDays;
int calories=2663*userAgeDays;
int net=1300*userAgeDays+calories;
printf("Enter the calories of 1 sandwich: ");
int num;
scanf("%d",&num);
printf("Number of sandwiches needed are %d\n",net/num+1);
return 0;
}

Kindly revert for any queries

Thanks.


Related Solutions

C++ Read first a user's given name followed by the user's age from standard input. Then...
C++ Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata (which you must declare) to write this information separated by a space into a file called outdata. Assume that this is the extent of the output that this program will do. Declare any variables that you need.
Write a RIMS-compatible C-language for-loop that counts the number of times a bit of A is...
Write a RIMS-compatible C-language for-loop that counts the number of times a bit of A is followed by a bit of the opposite parity (01 or 10) and writes the value to B. For example 00100110 has 4 cases: 00100110, 00100110, 00100110, 00100110.
Make a C++ program that reads the age of a person, if the person is between...
Make a C++ program that reads the age of a person, if the person is between 12 and 17 years old, a message that says "Teenager!" otherwise print "Not a teenager."
c# language Create a class “Person” which included first name, last name, age, gender, salary, and...
c# language Create a class “Person” which included first name, last name, age, gender, salary, and havekids (Boolean) variables. You have to create constructors and prosperities for the class. Create a “MatchingDemo” class. In the main function, the program reads the number of people in the database from the “PersonInfo.txt” file and creates a dynamic array of the object. It also reads the people's information from “PersonInfo.txt” file and save them into the array. Give the user the ability to...
Write a program in C that prompts the user for a number of seconds and then...
Write a program in C that prompts the user for a number of seconds and then converts it to h:m:s format. Example: 5000 seconds should display as 1:23:20 (1 hour, 23 minutes, 20 seconds.) Test with several values between about 100 seconds and 10,000 seconds. use unint and remainders for this and keep it as simple as possible.
Write a program that calculates the compound interest for an investment. (C++ coding language) If you...
Write a program that calculates the compound interest for an investment. (C++ coding language) If you deposit an amount of money P , the principal, at an interest rate r then the interest will compound over time. This means that the interest earned each period becomes part of the principal and the next time you get interest you earn interest on the interest. This is known as compounding. The equation for compound interest is ( r)n·t Pn=P0 1+n where P0...
Design a c++ program that calculates the amount of money a person would earn over a...
Design a c++ program that calculates the amount of money a person would earn over a period of time if his salary is one penny the first day, two pennies second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, and then show total pay at the end of the period. the output should be displayed in a dollar amount,...
I believe that the number of times a person will yawn in a day is normally...
I believe that the number of times a person will yawn in a day is normally distributed, with a standard deviation of 3. If I do a study of 36 random individuals, and they have an average of 12 daily yawns with a standard deviation of 3.6, find a 99% confidence interval for the standard deviation in the number of daily yawns for the population of all people.
Are the mean number of times a month a person eats out the same for whites,...
Are the mean number of times a month a person eats out the same for whites, blacks, Hispanics and Asians? White Black Hispanic Asian 6 4 7 8 8 1 3 3 2 5 5 5 4 2 4 1 6 6 7 df numerator and denominator = Write Ho and Ha What is the p-value? Do you reject or accept the null hypothesis at the 5% level?
*C PROGRAMMING* Create a program which requires the computer to guess the user's number from 1-100....
*C PROGRAMMING* Create a program which requires the computer to guess the user's number from 1-100. The user does not need to enter their number at any point. The computer should just guess a random number, and then the user can choose whether or not the number is too high or too low, and if the computer does not guess the correct number, it will will keep guessing and eliminate the values from the range that is either too high...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT