Guest User

Untitled

a guest
Jul 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /* Look Ma, no error handling :D
  2. i know what the program does
  3. therefore i don't need it. */
  4.  
  5. #include <stdio.h>
  6. int main(void)
  7. {
  8. float kj;
  9. float pro;
  10. float car;
  11. float fat;
  12.  
  13. printf("\nEnter Nutrition Data:\n\n");
  14. printf("Kilojoules: ");
  15. scanf("%f", &kj);
  16. printf("Fat: ");
  17. scanf("%f", &fat);
  18. printf("Protein: ");
  19. scanf("%f", &pro);
  20. printf("Carbohydrate: ");
  21. scanf("%f", &car);
  22. printf("\n");
  23. printf("Total Calories: %.0f\n", kj / 4.148);
  24. printf("Breakdown...\n\n");
  25. printf("Fat: \t\t%2.2f%%\n", (fat * 9)/(kj/4.148)*100);
  26. printf("Protein: \t%2.2f%%\n", (pro * 4)/(kj/4.148)*100);
  27. printf("Carbohydrate: \t%2.2f%%\n\n", (car * 4)/(kj/4.148)*100);
  28.  
  29. }
Add Comment
Please, Sign In to add comment