WT Week1
WT Week1
OBJECTIVE:
RESOURCES:
PROGRAM LOGIC:
SOURCE CODE:
<?php
$num = 1 ;
while ($num <50 ) {
$count=0;
for ( $i=1;$i<=$num;$i++) {
if (($num%$i)==0) {
$count++;
}
}
if ($count<3) {
echo " Prime Number --> " .$num. " <br/>";
} $num=$num+1;
}
?>
OUTPUT:
VIVA QUESTIONS
15. What are the rules to determine the "truth" of any value not already of the Boolean
type?
19. What are the differences between PHP constants and variables?
21. What are the two most common ways to start and finish a PHP code block?
25. Explain the syntax for the 'for each' loop with an example.
26. What is the difference between single quoted string and double quoted string?
27. How to concatenate two strings in PHP?