Assignment:2

PHP

Assignment: 2

Control Structures and Loops


Practice Questions


Q.1 Write a PHP Script to display a maximum of two numbers.



Q.2 Write a PHP Script to check whether a number is positive or negative.:



Q.3 Write a PHP Script to display a Multiplication table of a number:



Set A


Q.1 Write a PHP Script to check whether a year is a leap or not.:



Q.2 Write a PHP Script which will perform the Addition, Subtraction, Multiplication, and Division of two numbers as per the choice. (Use Switch Case):



Q.3 Write a PHP Script to display the grade of the student according to percentage. Use the following conditions: Percentage <40 => Grade=”Fail” Percentage >= 40 and Percentage <=50 => Grade= “Pass Class” Percentage >=50 and Percentage <=60 => Grade= “Higher Second Class” Percentage >60 and Percentage <=70 => Grade= “First Class” Percentage >70 => Grade= “First Class with Distinction”:



Set B


Q.1 Write a PHP Script to display prime numbers between 1 to 50.:



Q.2 Write a PHP Script to display a perfect numbers between 1 to100.:



Q.3 Write a PHP Script to display the reverse of a number. E.g. 607 =>706:



Q.4 Write a PHP Script to display Armstrong numbers between 1 to 500.:



Set C


Q.1 Write a PHP script to display a number in words (Use Switch case) e.g. 345–three four five:



Q.2 Write a PHP script to change the background color of the browser using a switch statement according to the day of the week.:



Q.3 Write a PHP script to count the total number of even and odd numbers between 1 to 1000.: