Just for Java Learning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 rivejä
739 B

  1. package tutorial;
  2. import java.util.Scanner;
  3. public class CalLDLCholesterol{
  4. public static void main(String[] args) {
  5. Scanner input = new Scanner(System.in);
  6. //Total Cholesterol (TC), HDL cholesterol (HDLC), triglyceride (TG), LDL cholesterol (LDLC)
  7. //LDLC = TC - HDLC - TG / 5
  8. int TC, HDLC, TG;
  9. float LDLC;
  10. System.out.println("This program can be used to calculate LDL Cholesterol");
  11. System.out.print("Enter Total Cholesterol (TC) : ");
  12. TC = input.nextInt();
  13. System.out.print("Enter HDL Cholesterol (HDLC) : ");
  14. HDLC = input.nextInt();
  15. System.out.print("Enter Triglyceride (TG) : ");
  16. TG = input.nextInt();
  17. LDLC = TC - HDLC - TG / 5;
  18. System.out.println("LDL Cholesterol (LDLC) = " + LDLC);
  19. }
  20. }