Created
November 6, 2025 13:28
-
-
Save crmpicco/15902395c6dadd0df27008816971538f to your computer and use it in GitHub Desktop.
Perl vat calc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/perl | |
| # works out how much VAT you've paid on a given amount | |
| # Change the amount on the next line for the VAT rate | |
| # Uses a while loop to allow multiple calculations | |
| $vat = 17.5; | |
| print "Please enter an amount paid including the VAT or 0 to quit ........ "; | |
| $amount = <STDIN> ; | |
| while ($amount != 0) | |
| { | |
| $Vat = ( $amount - ($amount * 100 / (100 + $vat))); | |
| printf("You paid %.2f VAT\n", $Vat); | |
| print "Please enter another amount paid including the VAT "; | |
| $amount = <STDIN> ; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment