Sunday, March 25, 2018

Armstrong Program In HTML.

This Program Is About How To Check Number Is Armstrong Or Not In HTML.



<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<script language="javascript">
var no;
var temp;
var sum=0;
var original;
no=parseInt(prompt("enter number:"));
original=no;
while(no>0)
{
temp=no%10;
sum+=(temp*temp*temp);
no=parseInt(no/10);
}
if(sum==original)
{
document.write("This is an Armstrong No=",original);
}
else
{
document.write("This is Not an Armstrong No=",original);
}
</script>

</body>
</html>

Saturday, March 24, 2018

ABCD Pyramid Program In PHP

This Program Is About How To Create Pyramid Of ABC In PHP. 



<?php
echo"<br>";

$i;
$j;
for($i=65;$i<=69;$i++)
{
for($j=65;$j<=$i;$j++)
{
echo chr($j);
}
echo"<br>";
}
?>

Number Pyramid Program In PHP

This Program Is About How To Create Pyramid Of Number In PHP.


1 next program


<?php
$i;
$j;
for($i=1;$i<=5;$i++)
{
for($j=$i;$j>=1;$j--)
{
echo"$j   ";
}
echo"<br>";
}
?>

2 next program



<?php
echo"<br>";

$i;
$j;
for($i=1;$i<=5;$i++)
{
for($j=1;$j<=$i;$j++)
{
echo"$j";
}
echo"<br>";
}
?>



3 next program


<?php

echo"<br>";
$i;
$j;
for($i=1;$i<=5;$i++)
{
for($j=$i;$j>=1;$j--)
{
echo"$i";
}
echo"<br>";
}
?>

Find The Cube Of A Number In PHP

This Program Is About How To Find Cube Of Given Number In PHP.


PHP CODE FILE


<?php

echo"<h2> 2 cube of no <h2>";
function cube($a)

{
$cube=$a*$a*$a;
return $cube;
}
$x=5;
$ans=cube($x);
echo"cube is:".$ans;


?>

Find The Square Root Of A Number In PHP

This Program Is About How To Find Square Root Of Given Number In PHP.


PHP CODE FILE


<?php
function sqr($a)

{
$sqr=$a*$a;
return $sqr;
}
$x=5;
$ans=sqr($x);
echo"<h1>1 squre root <h1>";
echo"squre is:".$ans;

?>

Palindrome Program In PHP Using While Loop

This Program Is About How To Given Number Is Palindrome Or Not In Php


PHP FILE CODE

<?php
$n=1234;
$R=0;
$d=$a;
while($d!=0)
{
$R=$R*10;
$R=$R+($n%10);
$n=(int)($n/10);
}
if($R==$d)
{
echo "Number is Palindrome";
}
else
{
echo "Number is Not Palindrome";
}
?>

Odd And Even Number Program In PHP


This Program Is About How To Find Odd And Even Number In Php Using Given Number Into The Html Text Box.


PHP FILE CODE


<?php
$n=$_POST['n'];


    if(isset($_POST['submit']))
{
for($i=0;$i<=$n;$i++)
{

if($i%2==0)
     {
$s+=$i;
echo $s;
}
else
{
$o+=$i;
echo $o;

}
}
}
else
{
}
?>

HTML FILE CODE


<html>
    <head>
<title>odd even number</title>
</head>
<body>
<form method="post">
range start 0;
<input  type="text" name="n">
<input  type="submit" name="submit" value="submit">
</form>

<input type="text" value="<?php echo $s; ?>">
<input type="text" value="<?php echo $o; ?>" >

</body>
</html>

Generate Even Numbers in a Range In PHP.

$start = 1; $end = 20; for ($i = $start; $i <= $end; $i++) {     if ($i % 2 == 0) {         echo $i . " is even.<br>";   ...