>>25 Const ap As Integer = 100
Const ml As Integer = 800
Const ns As Integer = 200
Dim c_ap As Integer, c_ml As Integer, c_ns As Integer
Dim a As Integer, b As Integer, c As Integer
Dim ren1 As String, ren2 As String, ren3 As String
a = ap * 5 + ns * 3
b = (ap + ml + ns) * 2
c = (ap + ml) * 10 + ns * 3
ren1 = "A=" & CStr(a) & "円, B=" & CStr(b) & "円, C=" & CStr(c) & "円"
c_ap = 5 + 2 + 10
c_ml = 2 + 10
c_ns = 3 + 2 + 3
ren2 = "リンゴ=" & CStr(c_ap) & "個, " & CStr(c_ap * ap) & "円" & _
", メロン=" & CStr(c_ml) & "個, " & CStr(c_ml * ml) & "円" & _
", 梨=" & CStr(c_ns) & "個, " & CStr(c_ns * ns) & "円"
ren3 = CStr(a + b + c) & "円"
MsgBox (ren1 & vbCrLf & ren2 & vbCrLf & ren3)
返信する