settingsAccountsettings
By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy
Menusettings

Q: Pounds to Dollars - PHP Task

+2 votes

Write a program that converts British pounds(real number) to dollars formatted to 3th decimal point.

1 British Pound = 1.31 Dollars

Examples:

pounds to dollars php task

asked in PHP category by user hues

2 Answers

+1 vote

My solution:

<?php

$inputPounds = readline();
$dollar = $inputPounds * 1.31;

echo number_format($dollar,3,'.','');
answered by user andrew
+1 vote

Or on 1 line:

<?php

echo number_format(readline()*1.31,3,'.','');
answered by user hues
...