Notice: Undefined index: alg in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
82
Notice: Undefined index: url2 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
84
Notice: Undefined index: url3 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
85
Notice: Undefined index: url4 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
86
Notice: Undefined index: url5 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
87
Notice: Undefined index: url6 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
88
Notice: Undefined index: url7 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
89
Notice: Undefined index: url8 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
90
Notice: Undefined index: url9 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
91
Notice: Undefined index: url10 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
92
Notice: Undefined index: url11 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
93
Notice: Undefined index: url12 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
94
Notice: Undefined index: url13 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
95
Notice: Undefined index: opurl2 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
98
Notice: Undefined index: opurl3 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
99
Notice: Undefined index: opurl4 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
100
Notice: Undefined index: opurl5 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
101
Notice: Undefined index: opurl6 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
102
Notice: Undefined index: opurl7 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
103
Notice: Undefined index: opurl8 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
104
Notice: Undefined index: opurl9 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
105
Notice: Undefined index: opurl10 in
/home/u681245571/domains/studyglance.in/public_html/labprograms/r18wtdisplay.php on line
106
[R18] Web Technologies Lab Manual B-Tech III Year I Semester (3-1) CSE JNTU Hyderabad (JNTUH).
Aim:
Write a PHP script to print prime numbers between 1-50
Source Code:
Week-1/Week1.php
<html>
<head>
<title>The Prime Numbers between 1-50</title>
</head>
<body>
<?php
echo "<strong>The Prime Numbers between 1-50 are :</strong><br>";
$n = 2;
while($n < 50)
{
$cnt=0;
for($i = 1;$i <= $n;$i++)
{
if (($n % $i) == 0)
{
$cnt++;
}
}
if($cnt <= 2)
{
echo $n."<br>";
}
$n = $n + 1;
}
?>
</body>
</html>
Output:
Related Content :
Web Programming Lab Manual
1) Write a PHP script to print prime numbers between 1-50 View Solution
2) PHP script to
a) Find the length of a string.
b) Count no of words in a string.
c) Reverse a string.
d) Search for a specific string. View Solution
3) Write a PHP script to merge two arrays and sort them as numbers, in descending order View Solution
4) Write a PHP script that reads data from one file and write into another file. View Solution
5) Develop static pages (using Only HTML) of an online book store. The pages should resemble: www.amazon.com. The website should consist the following pages.
a) Home page
b) Registration and user Login
c) User Profile Page
d) Books catalog
e) Shopping Cart
f) Payment By credit card
g) Order Conformation View Solution
6) Validate the Registration, user login, user profile and payment by credit card pages using JavaScript. View Solution
7) Create and save an XML document on the server, which contains 10 users information. Write a program, which takes User Id as an input and returns the user details by taking the user information from the XML document. View Solution
8) Install TOMCAT web server. Convert the static web pages of assignments 2 into dynamic web pages using servlets and cookies. Hint: Users information (user id, password, credit card number) would be stored in web.xml. Each user should have a separate Shopping Cart. View Solution
9) Redo the previous task using JSP by converting the static web pages of assignments 2 into dynamic web pages. Create a database with user information and books information. The books catalogue should be dynamically loaded from the database. Follow the MVC architecture while doing the website. View Solution