Sunday, November 30, 2014

Practice Problem 2 Solution

'Answer for Problem 2'

dim item (1 to 9999) as string
dim cost (1 to 9999) as integer
total = 0
print "Welcome"
print "enter the number of items being purchased"
input num
for x = 1 to num
   print "enter the name of the item purchased"
   input item$(x)
   print "enter the cost of the item"
   input cost(x)
   total = total + cost(x)
next
dis = total * 0.2
bill = total - dis
print "the total bill after disocunt is", bill
print "A list of items purchased is below"
Print "Item", "Cost"
for x = 1 to num
print item$(x), cost(x)
next
input key

No comments:

Post a Comment