Posts

PHP 2nd ia

 6th program  <?php date_default_timezone_set('Asia/calcutta'); $Hour=date('G'); echo "The current time is(in 24-hour format):".$Hour."<br>"; if($Hour<12) { echo "Good Morning"; } else if($Hour>=12 && $Hour<18) { echo "Good Afternoon"; } else if($Hour>=18 && $Hour<24) { echo "Good Evening"; } else { echo "Good Night"; } ?> 7th program  <?php $gcd=""; $lcm=""; if(isset($_POST['submit'])) { $a=$_POST['first']; $b=$_POST['second']; function GCD($a,$b) { if($b==0) { return $a; } else { return gcd($b,$a%$b); } } $gcd=GCD($a,$b); $lcm=($a*$b)/$gcd; } ?> <html> <head> <title>GCD and Lcm</title> </head> <body> <center> <form method="post"> <h1>GCD and LCM Calculator</h1> <label>Enter first number:</label> <input type="text" name=...

PHP

 1 .Prime number pgm <?php function isPrime($number) {     if($number<=1)     {      return false;       }     for($i=2;$i<=sqrt($number);$i++)     {     if($number%$i==0)         {             return false;         }     }     return true; } function displayprimesInRange($start,$end) { $primes=[]; $primeCount=0; for($i=$start;$i<=$end;$i++) { if(isPrime($i)) {     $primes[]=$i;     $primeCount++; } } echo "prime numbers between $start and $end are:".implode(",",$primes)."</br>"; echo "total number of prime numbers:$primeCount<br>"; } $start=3; $end=10; displayprimesInRange($start,$end); ?> 2. Message passing pgm  <html> <head>     <title>Message Passing</title> </head> <body>     <center> <form...