DISPLAY NUMBERS FROM 1 TO 10
USING FOR
LOOP.
INPUT:
<html>
<head><h1> Display numbers from 1 to 10 using
<strong><i>for
loop</i></strong></h1></head>
<body>
<H1>
<?php
$sanket;
for($sanket=1;$sanket<=10;$sanket++)
{
echo $sanket."<br>";
}
?>
</h1>
</body>
</html>
ADDING
TWO NO.
INPUT:
<html>
<head><h1>Addition Of Two Numbers</h1></head>
<body>
<H1>
<?php
$sanket1=5;
$sanket2=15;
$sanket3=$sanket1+$sanket2;
echo "a =".$sanket1."<br>b
=".$sanket2."<br>c =".$sanket3;
?>
</h1>
</body>
</html>
DISPLAY NUMBERS FROM 1 TO 10
USING WHILE LOOP.
INPUT:
<html>
<head><h1> Display numbers from 1 to 10
using <strong><i>while
loop</i></strong></h1></head>
<body>
<H1>
<?php
$sanket=1;
while($sanket<=10)
{
echo $sanket."<br>";
$sanket++;
}
?>
</h1>
</body>
</html>
DISPLAY NUMBERS FROM 1 TO 10
USING DO-WHILE LOOP.
INPUT:
<html>
<head><h1> Display numbers from 1 to 10 using
<strong><i>Do-while loop</i></strong></h1></head>
<body>
<H1>
<?php
$sanket=1;
do
{
echo $sanket."<br>";
$sanket++;
}
while($sanket<=10)
?>
</h1>
</body>
</html>
DISPLAY NUMBERS FROM 1 TO 10
USING CONTINUE.
INPUT:
<html>
<head><h1> Display numbers from 1 to 10
using <strong><i>Continue</i></strong>
statement.</h1></head>
<body>
<H1>
<?php
$sanket;
for($sanket=1;$sanket<=10;$sanket++)
{
if($sanket==5)
{
continue;
}
echo $sanket."<br>";
}
?>
</h1>
</body>
</html>
DISPLAY EVEN NUMBERS BETWEEN 1 TO 100.
INPUT:
<html>
<head><h1> Display even numbers between 1 to
100.</h1></head>
<body>
<H1>
<?php
$sanket;
for($sanket=1;$sanket<=100;$sanket++)
{
if($sanket%2==0)
{
echo $sanket."<br>";
}
}
?>
</h1>
</body>
</html>
FACTORIAL.
INPUT:
<html>
<body>
<H1>
<?php
$sanket1;$sanket2=1;
for($sanket1=1;$sanket1<=5;$sanket1++)
$sanket2=$sanket2*$sanket1;
echo "factorial of 5 =
".$sanket2;
?>
</h1>
</body>
</html>
FIBONACCI
SERIES.
INPUT:
<html>
<head><h1>Fibonacci series.</h1></head>
<body>
<H1>
<?php
$sanket1;$sanket2=0;$sanket3=1;$sanket4;
echo $sanket2."<br>";
echo $sanket3."<br>";
for($sanket1=2;$sanket1<=9;$sanket1++)
{
$sanket4=$sanket2+$sanket3;
$sanket2=$sanket3;
$sanket3=$sanket4;
echo $sanket4."<br>";
}
?>
</h1>
</body>
</html>
PRIME OR NOT.
INPUT:
<html>
<head><h1> Check whether the numbers are prime or not
.</h1></head>
<body>
<H1>
<?php
$c;$sanket;$x;
for($x=2;$x<=100;$x++)
{
$c=0;
for($sanket=2;$sanket<=($x/2);$sanket++)
{
if(($x%$sanket)==0)
$c++;
}
if($c==0)
{
echo $x." is a prime number<br>";
}
else
{
echo $x." is not a prime number<br>";
}
}
?>
</h1>
</body>
</html>
TABLE OF 5 .
INPUT:
<html>
<head><h1> Table of 5 till 20. </h1></head>
<?php
$sanket=1;$b=5;$c;
for($sanket=1;$sanket<=20;$sanket++)
{
$c=$b*$sanket;
echo
"<b>5*".$sanket."=".$c."<br></b>";
}
?>
</head>
</html>
ARRAY.
INPUT:
<html>
<body>
<STRONG>
<?php
$sanket[0]="aaa";
$sanket[1]="bbb";
$sanket[2]="ccc";
$sanket[3]="ddd";
$sanket[4]="eee";
$sanket[5]="fff";
$sanket[6]="ggg";
echo
$sanket[0]."<br>".$sanket[1]."<br>".$sanket[2]."<br>".$sanket[3]."<br>".$sanket[4]."<br>".$sanket[5]."<br>".$sanket[6]."<br>";
?>
</STRONG>
</body>
</html>
DATE.
INPUT:
<html>
<body>
<b>
HH-MM-SS =
<?php
echo
date("h:i:s")."<br>";
?>
</b>
</body>
</html>
MATH FUNCTION.
INPUT:
<html>
<body>
<b>
<?php
echo "Cosine value of 90 = ".cos(90);
echo "<br>Max of 10,20 = ".max(10,20);
echo "<br>Power of 2 raise to 5 = ".pow(2,5);
echo "<br>Exponential value of 90 = ".exp(90);
echo "<br>Log of 1 = ".log(1);
echo "<br>Minimum of 54,65,24 = ".min(54,65,24);
echo "<br>Rounded value of 25.645 = ".round(25.645);
echo "<br>Tan value of 45 = ".tan(45);
echo "<br>Square root of 64 = ".sqrt(64);
echo "<br>floor of 53.2 = ".floor(53.2);
echo "<br>ceil of 53.2 = ".ceil(53.2);
echo "<br>Random no = ".rand();
?>
</b>
</body>
</html>
DISPLAY PROFILE.
DISPLAY PROFILE.
INPUT:
<html>
<head><h1>Display
Profile</h1></head>
<body>
<H1>
<?php
$sanket1="AAA";
$sanket2="F.Y.I.T";
$sanket3="2120xx";
$sanket4="WCCBM";
echo
"Name =".$sanket1."<br>Course
=".$sanket2."<br>Rollno =".$sanket3."<br>College
=".$sanket4;
?>
</h1>
</body>
</html>
RESULT.
INPUT:
<html>
<head><h1>Display Result</h1></head>
<body>
<H1>
<?php
$sanket_pcs=90;
$sanket_maths1=90;
$sanket_etc=90;
$sanket_fdc=90;
$sanket_cpp=90;
$sanket_maths2=90;
$sanket_wdp=90;
$sanket_dcn=90;
$sanket_dbms=90;
$sanket_mmc=90;
$sanket_sem1=$sanket_pcs+$sanket_maths1+$sanket_etc+$sanket_fdc+$sanket_cpp;
$sanket_sem2=$sanket_maths2+$sanket_wdp+$sanket_dcn+$sanket_dbms+$sanket_mmc;
$sanket_total=$sanket_sem1+$sanket_sem2;
$sanket_average=$sanket_total/10;
echo "<br>Semester 1 =".$sanket_sem1;
echo "<br>Semester 2 =".$sanket_sem2;
echo "<br>First Year Total Marks =".$sanket_total;
echo "<br>Average =".$sanket_average;
?>
</h1>
</body>
</html>
SIMPLE INTEREST.
INPUT:
<html>
<head><h1>Display
Profile</h1></head>
<body>
<H1>
<?php
$sanket_p=10;
$sanket_n=10;
$sanket_r=1;
$sanket_pi=($sanket_p*$sanket_n*$sanket_r)/100;
echo "
Simple Interest =".$sanket_pi;
?>
</h1>
</body>
</html>
EVEN OR ODD.
INPUT:
<html>
<head><h1>Check
whether even or odd</h1></head>
<body>
<H1>
<?php
$sanket_a=10;
if($sanket_a%2==0)
echo
$sanket_a." is an Even number";
else
echo
$sanket_a." is an Odd number";
?>
</h1>
</body>
</html>
ARRAY USING FOREACH STATEMENT.
INPUT:
<html>
<head><h1>Array
using foreach statement</h1></head>
<body>
<H1>
<?php
$sanket_a=array(1,2,3,4);
foreach($sanket_a
as $sanket_i)
echo
$sanket_i;
?>
</h1>
</body>
</html>
CHECK GIVEN NUMBER IS PALINDROME OR NOT.
INPUT:
<html>
<head><h1>Check
whether given number is palindrome or not</h1></head>
<body>
<H1>
<?php
$sanket_n=12345;
$sanket_dn=$sanket_n;
$sanket_t=0;
$sanket_d;
while($sanket_dn!=0)
{
$sanket_d=$sanket_dn%10;
$sanket_t=($sanket_t*10)+$sanket_d;
$sanket_dn=($sanket_dn/10);
}
if($sanket_n==$sanket_t)
{
echo "
The number ".$sanket_n." is a palindrome";
}
else
{
echo "
The number ".$sanket_n." is not a palindrome";
}
?>
</h1>
</body>
</html>
PRIME OR COMPOSITE.
INPUT:
<html>
<head><h1>
Check whether the numbers are prime or not .</h1></head>
<body>
<H1>
<?php
$sanket_a=10;
$c;
$sanket;
$x;
for($x=2;$x<=$sanket_a-1;$x++)
{
$c=0;
for($sanket=2;$sanket<=($x/2);$sanket++)
{
if(($x%$sanket)==0)
$c++;
}
}
if($c==0)
{
echo
$x." is a prime number<br>";
}
else
{
echo
$x." is a composite number<br>";
}
?>
</h1>
</body>
</html>
DISPLAY NAME 10 TIMES & TOTAL AVERAGE OF 6 SEMESTER
INPUT:
<html>
<head><h1>Display
10 times name and average marks</h1></head>
<body>
<H1>
<?php
$sanket_average;
$sanket_total;
$sanket_sem1=400;
$sanket_sem2=400;
$sanket_sem3=400;
$sanket_sem4=400;
$sanket_sem5=400;
$sanket_sem6=400;
$sanket;
for($sanket=1;$sanket<=10;$sanket++)
{
echo
"AAA<br>";
}
$sanket_total=$sanket_sem1+$sanket_sem2+$sanket_sem3+$sanket_sem4+$sanket_sem5+$sanket_sem6;
$sanket_average=($sanket_total/3000)*100;
echo
"Total average = ".$sanket_average;
?>
</h1>
</body>
</html>
OUTPUT:
SUBMIT FORM USING PHP..
INPUT:
SUBMIT.html:
<html>
<body>
<form
action="hai.php" method="post">
Enter the
Name:
<input
type="text" name="name1"/><br/>
Enter the
College:
<input
type="text" name="college"/><br/>
<input
type="submit"/>
</form>
</body>
</html>
hai.php:
<html>
<body>
<h1>
<?php
echo
$_POST["name1"]."<br>";
echo
$_POST["college"];
?>
</h1>
</body>
</html>
OUTPUT:
submit.html:
submit.html:
Hai.php:
No comments:
Post a Comment