Pure Programmer
Blue Matrix


Cluster Map

Project: Supermarket Sale (Revisited)

A supermarket is having a sale on 2-liter bottles of soda: buy 2, get one free. A 2-liter bottle of soda is priced at $1.29. Write a program that prints the price for 1 through 12 bottles of soda. Remember to round prices to dollars and cents.

Output
$ perl SupermarketSale2.pl 1 bottle(s) is $1.29 2 bottle(s) is $2.58 3 bottle(s) is $2.58 4 bottle(s) is $3.87 5 bottle(s) is $5.16 6 bottle(s) is $5.16 7 bottle(s) is $6.45 8 bottle(s) is $7.74 9 bottle(s) is $7.74 10 bottle(s) is $9.03 11 bottle(s) is $10.32 12 bottle(s) is $10.32

Solution