Posts

Showing posts from May, 2025

Calculate Factorial using While loop in JavaScript.

 AIM:  Source Code: <!DOCTYPE html> <html lang="en"> <head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <title>Document</title> </head> <body>  <input type="button" onclick="multi_3n5()" value="click here">  <script>  function multi_3n5() {  var n = parseInt(prompt("Number : "));  var i=1,f=1;  while(i<=n){  f=f*i;  i++;  }  document.write("factorial of the number = "+f);}  </script> </body> </html>

Write a JavaScript program to sum multiples of 3 and 5 under 1000

 AIM:  Source Code: <!DOCTYPE html> <html lang="en"> <head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <title>Document</title> </head> <body>  <input type="button" onclick="multi_3n5()" value="click here">  <script>  function multi_3n5() {  var i,sum=0;  for(i=1;i<=1000;i++){  if(i%3==0){  sum=sum+i;  }  else if(i%5==0){  sum=sum+i;  }}  document.write("sum multiples of 3 and 5 under 1000= "+sum);}  </script> </body> </html>

Largest of three numbers

 AIM: Find the largest of three numbers. Source Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <input type="button" onclick="gt3()" value="click here"> <script> function gt3() { var n1= parseInt(prompt("first number: ")); var n2= parseInt(prompt("second number: ")); var n3= parseInt(prompt("third number: ")); if(n1>n2){ if(n1>n3){ document.writeln(n1+" is the greatest number");} else{ document.writeln(n3+" is the greatest number");}} else if(n2>n3){ document.writeln(n2+" is the greatest number");} else{ document.writeln(n3+" is the greatest number");}} </script> </body> </html>

Odd or even

 AIM: Write a program to check if a number is odd or even. Source Code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <input type="button" onclick="odd()" value="click here"> <script> function odd() { var n= parseInt(prompt("number: ")); if(n%2!=0){ document.writeln("this is an odd number");} else{ document.writeln("this is an even number");}} </script> </body> </html>

Amrita website

 AIM: Create a web site for Amrita School of Arts and Sciences. (Hint: CSS3 and HTML5). SOURCE CODE: <!DOCTYPE html> <html lang="en"> <head>  <title>record 12</title>  <link rel="stylesheet" href="r12.css">  <link rel="icon" type="image/png" href="amrita.png"> </head> <body>  <header>  <h1>Amrita Vishwa Vidyapeetham,Kochi Campus</h1> </header> <br> <div> <navbar class="navbar">  <ul>  <li><a href="https://www.amrita.edu/campus/kochi"> Home</a></li>  <li><a href="https://www.amrita.edu/news-all"> News</a></li>  <li><a href="https://www.amrita.edu/jobs/"> Jobs</a></li>  </ul> </navbar> </div> <main>  <section>  <h2>About us</h2>  <p>The expansive and serene Brahmasthanam ...

Travel package

 <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <title>Europe Tour Packages</title>     <style>         body {             font-family: Arial, sans-serif;             margin: 40px auto;             max-width: 800px;             padding: 0 20px;         }         h1 {             text-align: center;         }         h2 {             color: #007BFF;         }         .package {             border: 1px solid #ccc;             border-radius: 10px;             padding: 20px;     ...

Website

 SOURCE CODE: <!DOCTYPE html> <html>  <title>record 11</title>  <link rel="stylesheet" href="r11.css"> </head> <body>  <div class="head">  <h1>Welcome to my Website...</h1><br>  <h2>Hello!</h2>  </div><br>  <div class="intro">  <h1>INTRODUCTION</h1> <p>Hi, I'm THUSHAR RAJEEV coming from PALACHUVAD , KAKKANAD. I'm currently pursuing Integrated MCA at Amrita Vishwa Vidyapeetham,Kochi Campus. I have done my Schooling At BHAVAN'S ADARSHA VIDYALAYA , KAKKANAD.I'm very passionate in web development and coding.</p> </div><br>  <div class="skills">  <h1>SKILLS</h1>  <center>  <ul>  <li>Python</li>  <li>C Programming</li>  <li>SQL</li>  <li>HTML</li>  <li>JAVA</li>  </ul>  ...

Eth question vannu

 Comment pannra

Create a simple AngularJS application that display a student details (Name, Age, Batch).

Allow the user to add details using an input form. Source Code: <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> let myApp=angular.module("app",[]); myApp.controller("controller",function($scope){ $scope.userData={}; $scope.getData=function(user){ $scope.userData=angular.copy(user); } }) </script> </head> <body> <div ng-app="app"> <div ng-controller="controller"> <form action="javascript:void(0)"> Name:<input type="text" ng-model="user.name"><br><br> Age:<input type="text" ng-model="user.age"><br><br> Batch:<input type="text...

Create an HTML login form that sends data to a PHP script for authentication

  Source Code: <html> <form htmlspecialchars($_SERVER[PHP_SELF]) method="POST"> <body> Username=<input type="text" name="user"><br> Password<input type="password" name="pwd"><br> <input type="submit" name="submit" value="Login"> </form> <?php $valid_name="admin"; $valid_pwd="admin123"; if($_SERVER["REQUEST_METHOD"]=="POST"){ $user=$_POST['user']; $pwd=$_POST['pwd']; if(($user $valid_name) && (Spwd $valid_pwd)){ echo "Login Successful Welcome ".htmlspecialchars($user); 1 else{ echo "Incorrect UserName and Password": 1 J </body> </html>

Create a PHP script to insert, retrieve, update, and delete records from a MySQL table.

  Source Code: <?php $connection=mysqli_connect("localhost","root","","phpdb"); $query="create table student(sid int,sname varchar(30).marks float)"; if(mysqli_query($connection, $query)) { echo "Table creation Successfull!!";) else{ echo "Error creating table:" mysqli_error(Sconnection). "<br>";} $query1="insert into student values(101, 'Sreejith',99);"; $queryl.="insert into student values(102, 'Meera', 79);"; Squery1.="insert into student values(103,'Anu',69);"; if(mysqli_multi_query($connection.Squery1)){ echo "Insertion Successfull!!";} else echo "Error insertion:"mysqli_error($connection). "<br>";) $query2="update student set marks=100 where sid=101"; $con2=mysqli_query($connection, $query2); if($con2)( echo "Updation Successfull!!";) else{ echo "Error creating table:" mysql...

Write a PHP script to establish a connection with a MySQL database using MySQL

Source Code: <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "test_db"; Sconn = new mysqli(Sservername, $username, Spassword); if ($conn->connect_error) { die("Connection failed: ". Sconn->connect_error); echo "Connected successfully to the database!"; $conn->close();

Write a PHP script to demonstrate the following string functions:

  1. strlen() 2. strrev() 3. strpos() 4. str_replace() 5. substr() Source Code: <?php $text "Hello, PHP world!"; $length = strlen($text); echo "Length of the string: Slength"."<br>"; Sreversed strrev($text); echo "Reversed string: $reversed","<br>"; $position = strpos($text, 'PHP'); echo "Position of 'PHP": $position","<br>"; $replaced = str_replace('world', 'everyone', $text); echo "String after replacement: $replaced","<br>"; $substring substr($text, 7, 3); echo "Substring (7 to 10): Ssubstring","<br>"; ?>

Create a simple XML file to store information about three books, including title, author, and price. Then, write a PHP script to read and display the data

 : . Source Code: q34.xml <bookstore> <book> <title>Goosbumps</title> <author>R.L Stire</author> <price>300</price> </book> <book> <title>Spiderman</title> <author>Stan Lee</author> <price>550</price> </book> <book> <title>My Life My Message</title> <author>Mahatma Gandhi</author> <price>600</price> </book> </bookstore> q34.php <?php xml=simplexml_load_file("q34.xml") or die("Error: cannot create an object"); $ echo"<h1>The Books are:<h1>"; foreach($xml->book as $book) [ echo"<h3>Title:".$book->title."<br></h3>"; echo"<h3>Author:" Sbook->author."<br></h3>"; echo"<h3>Price:" $book->price."<br></h3>"; 1