Q:

Write a PHP program that accepts six numbers as input and sorts them in descending order

0

Write a PHP program that accepts six numbers as input and sorts them in descending order.

Input: Input consists of six numbers n1, n2, n3, n4, n5, n6 (-100000 ≤ n1, n2, n3, n4, n5, n6 ≤ 100000). The six numbers are separated by a space

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$stdin = trim(fgets(STDIN));
$nums = explode(" ", $stdin);
rsort($nums);
print("After sorting the said integers:\n");
echo implode(' ', $nums);
?>

Sample Output:

After sorting the said integers:
9 8 7 6 4 2

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now