Last active
November 15, 2017 06:55
-
-
Save jnikolak/2bd6a710b89c501a8c87e5997fb5b30d to your computer and use it in GitHub Desktop.
How much Chocolate can you eat in a day?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
int main() | |
{ | |
char selector; | |
float height_in_feet,inches; | |
int weight,age,pounds,height_in_cm,bmr; | |
int choc = 230; | |
puts("Do you want to see how much chocolate you can eat in a day without getting fat?,\n (y/n)"); | |
selector=getchar(); | |
selector=toupper(selector); | |
if(selector == 'Y') | |
{ | |
printf("Enter your height in cms\n"); | |
scanf("%d",&height_in_cm); | |
puts("Enter your weight in kg's"); | |
scanf("%d",&weight); | |
puts("Enter your age"); | |
scanf("%d",&age); | |
pounds = weight * 2.2; | |
inches = height_in_cm / 2.54; | |
height_in_feet = (height_in_cm / 30.48); | |
bmr = 66 +(6.23 * pounds) + (12.7 * inches); | |
printf("you are %.2f feet tall.\n",height_in_feet); | |
printf("you are %.2f inches tall.\n",inches); | |
printf("You weigh %d kgs.\n",weight); | |
printf("In Pounds thats %d pounds.\n",pounds); | |
printf("Your BMR, i.e burn calories at rest is %d\n",bmr); | |
printf("You work in a desk job, so you can have this amount of calories %.2f.\n",bmr*1.2); | |
printf("You should be able to eat, %.2f chocolate bars\n",bmr*1.2/choc); | |
} | |
else | |
{ | |
printf("Ok No worries\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment