| Sr.No | Assignment name |
|---|---|
| Set-A | |
| 1 |
Write a php script to check whether a year is a leap or not Plz Click on Question to see AnswerFile Name:program1.html <html> <body> <form method="post" action="program1.php"> Enter Year: <input type="text" name="t1"><br> <input type="submit" value="ok"><br> </form> </body> </html> File Name:program1.php <?php $y=$_POST["t1"]; if($y%4==0) echo("year is leap"); else echo("year is not leap"); ?> |
| 2 |
write a php script which will perform the addition,substraction, multiplication and Divishion of two number as per the choice.(use switch case) Plz Click on Question to see AnswerFile Name:program2.html <html> <body> <h3>Option-1 = Addition</h3> <h3>Option-2 = Subtraction</h3> <h3>Option-3 = Multiplication</h3> <h3>Option-4 = Division</h3> <form method="post"> <table border="0"> <tr> <!-- Taking value 1 in an text box --> <td> <input type="text" name="num1" value="" placeholder="Enter value 1"/> </td> </tr> <tr> <!-- Taking value 1 in an text box --> <td> <input type="text" name="num2" value="" placeholder="Enter value 2"/> </td> </tr> <tr> <!-- Taking option in an text box --> <td> <input type="text" name="option" value="" placeholder="Enter option 1-4 only"/> </td> </tr> <tr> <td> <input type="submit" name="submit" value="Submit"/> </td> </tr> </table> </form> <?php // Checking submit condition if(isset($_POST['submit'])) { // Taking first number from the // form data to variable 'a' $a = $_POST['num1']; // Taking second number from the // form data to a variable 'b' $b = $_POST['num2']; // Taking option from the form // data to a variable 'ch' $ch = $_POST['option']; switch($ch) { case 1: // Execute addition operation // when option 1 is given $r = $a + $b; echo " Addition of two numbers = " . $r ; break; case 2: // Executing subtraction operation // when option 2 is given $r = $a - $b; echo " Subtraction of two numbers= " . $r ; break; case 3: // Executing multiplication operation // when option 3 is given $r = $a * $b; echo " Multiplication of two numbers = " . $r ; break; case 4: // Executing division operation // when option 4 is given $r = $a / $b; echo " Division of two numbers = " . $r ; break; default: // When 1 to 4 option is not given // then this condition is executed echo ("invalid option\n"); } return 0; } ?> </body> </html> |
| 3 |
Write a php script to display the grade of the student according to percentege.Use the following conditions. i. percentage<40=>Grade="Fail" ii.percentage>=40 and percentage<=50=>Grade="Pass class" iii.percentage>=50 and percentage<=60=>Grade="Higher Class" iv. percentage>60 and percentage<=70=>Grade="First class" v. Percentage>=70=>Grade="First class with Distinction". Plz Click on Question to see Answer<html> <body> <form method="post" action="aq3.php"> Enter Percentage: <input type="text" name="t1"><br> <input type="submit" value="ok"> </form> </body> </html> <?php $p=$_POST["t1"]; if($p<40) echo("Grade : fail"); else if ($p>=40 && $p<=50) echo("Grade : pass"); else if ($p>=50 && $p<=60) echo("Grade : Higher second Class"); else if ($p>=60 && $p<=70) echo("Grade : First class"); else if ($p>=70) echo("Grade : First calss with Distinction"); ?> |
| Set-B | |
| 1 |
Write a php Script to display prime numbers between 1 to 50. Plz Click on Question to see Answer<?php echo"prime numbers form 1 to 50 are :"; echo"<br>"; for($number=1;$number<=100;$number++) { $count=0; for($i=02;$i<=$number/2;$i++) { if($number%$i==0) { $count++; break; } } if($count==0 && $number!=1) { echo $number." ,"; } } ?> |
| 2 |
Write a PHP script to display Perfect numbers between 1 to 100. Plz Click on Question to see Answer<?php $number=1; $sum=0; $p; echo"perfect numbers between 1 to 100 are :<br>"; for($i=1;$i<=100;$i++) { $p=1; while($p<=($i/2)) { if($i % $p==0) $sum=$sum+$p; $p++; } if($sum==$i) echo $i." "; $sum=0; } ?> |
| 3 |
Write a PHP script to display reverse of a number. E.g. 607=>706 Plz Click on Question to see Answer<?php $num = 607; $revnum = 0; while ($num != 0) { $revnum = $revnum * 10 + $num % 10; //below cast is essential to round remainder towards zero $num = (int)($num / 10); } echo "Reverse number: $revnum"; ?> |
| 4 |
Write a PHP script to display Armstrong number between 1 to 500. Plz Click on Question to see Answer<?php $count=1; echo"Armstrong numbers between 1 to 500 are :<br>"; while($count<=500) { $num=$count; $sum=0; while($num) { $rem=$num%10; $sum=$sum+($rem*$rem*$rem); $num=$num/10; } if($count==$sum) { echo $count."<br>"; } $count++; } ?> |
| Set-C | |
| 1 |
Write a PHP script to display to display the number in words.(Use Switch Case) e.g.345-three four five Plz Click on Question to see Answer<html> <body> <form method="post" action="cq1.php"> Enter The Number: < input type="text" name="t1"><br> <input type="submit" value="submit"> </form> </body> </html> <?php $n=$_POST["t1"]; switch($n) { case "0":echo "ZERO"; break; case "1":echo "ONE"; break; case "2":echo "TWO"; break; case "3":echo "THREE"; break; case "4":echo "FOUR"; break; case "5":echo "FIVE"; break; case "6":echo "SIX"; break; case "7":echo "SEVEN"; break; case "8":echo "EIGHT"; break; case "9":echo "NINE"; break; } ?> |
| 2 |
Write a PHP script to change the background color of the browser using a switch statement according to the day of the week. Plz Click on Question to see Answer<html> <head> <form method=post action="cq2.php"> <input type=radio name=r1 value=1>MONDAY<br> <input type=radio name=r1 value=2>TUESDAY<br> <input type=radio name=r1 value=3>WEDNESDAY<br> <input type=radio name=r1 value=4>THURDAY<br> <input type=radio name=r1 value=5>FRIDAY<br> <input type=radio name=r1 value=6>SATURDAY<br> <input type=radio name=r1 value=7>SUNDAY<br> <input type=submit value=change> </form> </head> </html> <?php $opt=$_POST['r1']; switch($opt) { case 1: echo"<body bgcolor=red>"; echo "<h3>Page colour changed Red</h3>"; break; case 2: echo"<body bgcolor=blue>"; echo "<h3>Page colour changed Blue</h3>"; break; case 3: echo"<body bgcolor=cyan>"; echo "<h3>Page colour changed Cyan</h3>"; break; case 4: echo"<body bgcolor=yellow>"; echo "<h3>Page colour changed Yellow</h3>"; break; case 5: echo"<body bgcolor=brown>"; echo "<h3>Page colour changed Brown</h3>"; break; case 6: echo"<body bgcolor=green>"; echo "<h3>Page colour changed green</h3>"; break; case 7: echo"<body bgcolor=pink>"; echo "<h3>Page colour changed pink</h3>"; break; } ?> |
- Home
- SYLLABUS
- _FYBBA(CA)
- __DBMS
- __WEB TECHNOLOGY
- _SYBBA(CA)
- __PHP
- __ADVANCE PHP
- _TYBBA(CA)
- __CORE JAVA
- __ADVANCE JAVA
- NOTES
- _Database System
- __CHAPTER1
- __CHAPTER 2
- _Web Technology
- __Chapter-1
- __Chapter-2
- __Chapter-3
- _Advance PHP
- __Chapter-1
- __Chapter-2
- __Chapter-3
- Research
- About us
- Assignment
- certificate
- Solved Programs
- Problem
- _Lab Book
- _Practical Slips
- _Assignment Submit
- _Project Guideline
- __SYBBACA SEM-IV
- __TYBBACA SEM-V
- __TYBBACA SEM-VI
- _C language
- __Simple Program
- __Simple Program
0 Comments