Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double fats = Double.parseDouble(scanner.nextLine()),
- proteins = Double.parseDouble(scanner.nextLine()),
- carbohydrates = Double.parseDouble(scanner.nextLine()),
- calories = Double.parseDouble(scanner.nextLine()),
- water = Double.parseDouble(scanner.nextLine());
- double caloriesPerGram = (100 - water) * (calories / (calories * fats / 9
- + calories * proteins / 4 + calories * carbohydrates / 4));
- System.out.printf("%.4f\n", caloriesPerGram);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement