Warning: session_start() [function.session-start]: open(/tmp/sess_h7pbhsvt0kcodmp896385fsc76, O_RDWR) failed: Disk quota exceeded (122) in /home/vipozico/forum.tutorials7.com/qa-include/qa-app-users.php on line 143
Town Info - PHP Task
By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy

Q: Town Info - PHP Task

+3 votes

You will be given 3 lines of input. On the first line you will be given the name of the town, on the second – the population and on the third the area. Use the correct data types and print the result in the following format:

"Town {town name} has population of {population} and area {area} square km".


town info php task

asked in PHP category by user john7

1 Answer

+2 votes

My solution:


$town = readline();
$population = readline();
$area = readline();

echo "Town $town has population of $population and area $area square km.";
answered by user Jolie Ann