Page 446 - CITS - CSA - TP (Volume 1) - Hindi
P. 446

कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS





























            ेप 2 : िन  उप  ि या टाइप कर  और इसे मै ो स म वक  बुक म  सेव करे

           Sub Calculate_BMI()
               Dim weight As Double

               Dim height As Double
               Dim bmi As Double

               Dim result As String
           ‘ Prompt user to enter weight in kilograms
           weight = InputBox(“Enter your weight in kilograms:”)

           ‘ Prompt user to enter height in meters
           height = InputBox(“Enter your height in meters:”)
           ‘ Check if weight and height are greater than 0

               If weight > 0 And height > 0 Then
                   ‘ Calculate BMI using the formula: weight / (height * height)
           bmi = weight / (height * height)

           ‘ Determine the BMI category
                   If bmi< 18.5 Then

                       result = “Underweight”
           ElseIfbmi>= 18.5 And bmi< 25 Then
                       result = “Normal weight”
           ElseIfbmi>= 25 And bmi< 30 Then

                       result = “Overweight”
                   Else

                       result = “Obese”
                   End If
           ‘ Display the calculated BMI and category

           MsgBox “Your BMI is: “ &Round(bmi, 2) &vbCrLf& “BMI Category: “ & result


                                                           430

                                      CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 70
   441   442   443   444   445   446   447   448   449   450   451