+1 (315) 557-6473 

Program To Calculate BMI Using Drracket Assignment Solution.


Instructions

Objective
Write a Racket assignment program to calculate BMI.

Requirements and Specifications

need a short code that calculates a BMI (body Mass index)
The formula I worked out is as follows
BMI = Weight(kg) / (height (cm) *height(cm)) x10000
Using DrRacket compiler I can input weight in kg and height in cm and get BMI result
Screenshots
Write program to calculate BMI using DrRacket

Source Code

#lang racket

(define (read-weight)

  (display "Weight (kg)?: ")

  (read))

(define (read-height)

  (display "Height (cm)?: ")

  (read))

(define (bmi weight height)

  (* 10000.0 (/ weight (* height height))))

(define (calculate-bmi)

  (let ((x (bmi (read-weight) (read-height))))

    (display "BMI: ")

    (display x)

    (display "\n")))