Monday, 20 July 2015

Display 1 to 100 Addition in Php

Step:1 Create Php Page


Step:2 Coding

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<?php

$sum=0;
$i;

for($i=0;$i<=100;$i++)
{
$sum=$sum+$i;
}
echo '<font color=red size=+3>'."Sum of 1 to 100 is :".$sum.'</font>';


?>
<body>
</body>
</html>

Step:3 Save it on C drive => wamp folder => www folder => name your folder

Step:4 For Run Click on wampmanager


Step:5 Now Select Your Project and Run it 


No comments:

Post a Comment