PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 4: Write a PHP program to take 3 numbers from user and find the greatest number.


<!DOCTYPE html>
	<form action="program2.php" method="GET">
		Enter a First number : <input type="number" name="num1"><br/>
		Enter a Second number : <input type="number" name="num2"><br/>
		Enter a Third number : <input type="number" name="num3"><br/>
		<input type="submit">


		echo"1st number is $num1<br/>";
		echo"2nd number is $num2<br/>";
		echo"3rd number is $num3<br/>";

		if($num1>$num2 &&$num1>$num3)
			echo"num1 is greatest number";
		else if($num2>$num1 &&$num2>$num3)
			echo”$num2 is greatest number";
		else if($num3>$num2 &&$num3>$num1)
			echo"$num3 is greatest number";
			echo"numbers are equal";

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.