Q-1) Input three numbers and print the largest.
Here's the program I've written.
Private Sub Command1_Click()
Form1.Cls
a = InputBox("Enter the First Number")
b = InputBox("Enter the Second Number")
c = InputBox("Enter the Third Number")
If c > b Then
If c > a Then
largest = c
End If
ElseIf b > a Then
largest = b
Else
largest = a
End If
Print "The Largest Number is " & largest
End Sub
I've done something wrong with this. With some inputs, it works, with others it doesn't :/
Q-2) There are two types of tickets issued by an airline; 'Business' and 'Economy'. Both are allowed to carry a limited luggage weight with them. Write a program to input the ticket type and weight of the luggage of the passenger. Calculate his fine according to the info given below:
'Business' : Allowed Weight: 50kg. Fine: $200/kg for extra weight
'Economy' : Allowed Weight: 30kg. Fine: $400/kg for extra weight
I managed to write it with an "IF within IF structure" but I couldn't manage it with logical operators (AND,OR,NOT)
Any help with these would be greatly appreciated.


Sign In
Create Account

Back to top









