Write The Code To Execute and Verify The Results of The Following Situations
Write The Code To Execute and Verify The Results of The Following Situations
A. Ask the user for a temperature value in celcius (C) and convert it to Fahrenheit (F) value.
HINT : Formula is F = C * 9 / 5 + 32
Syntax
Sub temperature()
Dim c As Single, f As Single
c = InputBox("enter value in celcius")
f = c * 9 / 5 + 32
Debug.Print "tempeature in farenhite:" & f
End Sub
Output :
Syntax:
Sub length()
Dim inch As Single, cms As Single
inch = InputBox("enter value in inches")
cms = inch * 2.54
Debug.Print "lenght in cms is:" & cms
End Sub
Output:
Sub tempreature()
Dim mile As Single, kms As Single
mile = InputBox("enter value in miles")
kms = mile * 1.609344
Debug.Print "lenght in kms is:" & kms
End Sub
Output :
D. Ask the user to input the value of the sides of a cube and display the total surface area and volume of the
cube.
HINT:
1. Total surface area of cube : 6 * I^2
2. Volume of cube: I * I * I
Syntax:
Sub tempreature()
Dim i As Single
i = InputBox("enter side of cube")
area = 6 * i * i
volume = i * i * i
Debug.Print "area of cuboid is:" & area
Debug.Print "volume of cuboid is:" & volume
End Sub
Output: