Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

SCHOOL OF COMPUTER APPLICATION

(CAP 680: PROGRAMMING IN JAVA-LAB)

ASSIGNMENT-III
Set-Odd

Supervised by Prince Arora

Submitted by
ANUP KUMAR
Roll No: 37
Reg No. 11906059
Q1.: Calories Calculator, Food is low in fat or not.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("--CALORIES CALCULATOR--");
System.out.println("Enter Calories -->");
int calories = in.nextInt();
System.out.println("Enter Fat -->");
int fatGrams = in.nextInt();
int caloriesInFat = fatGrams * 9;
int percentageOfCalories = (caloriesInFat * 100) / calories;

System.out.println("Percentage of calories " + percentageOfCalories+"%");


if (percentageOfCalories < 30) {
System.out.println("Food is low in fat with percentage " +
percentageOfCalories+"%");
} else {
System.out.println("Food is not low in fat with percentage " +
percentageOfCalories+"%");
}
}
}

OUTPUT
*****

You might also like