Largest number in PHP
Q. Write a PHP program to find the largest number among three numbers
<?php
// Define three numbers
$a = 45;
$b = 78;
$c = 62;
// Use if-else statements to find the largest
if ($a >= $b && $a >= $c) {
echo "$a is the largest number.";
} elseif ($b >= $a && $b >= $c) {
echo "$b is the largest number.";
} else {
echo "$c is the largest number.";
}
?>
Q. Write an algorithm to find the largest number among three numbers in PHP
1. Start
2. Define three numbers: a, b, and c
3. If a >= b and a >= c, then
→ Print a is the largest
4. Else if b >= a and b >= c, then
→ Print b is the largest
5. Else
→ Print c is the largest
6. End
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com