diff --git a/assignment-07-googledrive-upload/1-prime-check.js b/assignment-07-googledrive-upload/1-prime-check.js new file mode 100644 index 0000000..33042ce --- /dev/null +++ b/assignment-07-googledrive-upload/1-prime-check.js @@ -0,0 +1,15 @@ +// Function to check if a number is prime +function isPrime(num) { + if (num < 2) return false; // Numbers less than 2 are not prime + + for (let i = 2; i <= Math.sqrt(num); i++) { // Loop from 2 to square root of num + if (num % i === 0) { + return false; // If divisible, it's not a prime number + } + } + return true; // If no divisor found, it's prime +} + +// Example usage +const number = 17; // Change this number to test other values +console.log(`${number} is ${isPrime(number) ? 'a prime' : 'not a prime'} number.`); \ No newline at end of file diff --git a/assignment-07-googledrive-upload/2-function-demo.js b/assignment-07-googledrive-upload/2-function-demo.js new file mode 100644 index 0000000..dc2c8bd --- /dev/null +++ b/assignment-07-googledrive-upload/2-function-demo.js @@ -0,0 +1,8 @@ +// Function definition +function addNumbers(a, b) { + return a + b; // Returns the sum of a and b +} + +// Function call +const sum = addNumbers(5, 10); +console.log(`Sum: ${sum}`); // Output the sum \ No newline at end of file diff --git a/assignment-07-googledrive-upload/3-css-demo.html b/assignment-07-googledrive-upload/3-css-demo.html new file mode 100644 index 0000000..7613a15 --- /dev/null +++ b/assignment-07-googledrive-upload/3-css-demo.html @@ -0,0 +1,33 @@ + + + + + + CSS Example + + + +
+

Welcome to CSS Styling

+

This is an example of inline CSS styling.

+
+ + + diff --git a/assignment-07-googledrive-upload/4-operators-data-types.js b/assignment-07-googledrive-upload/4-operators-data-types.js new file mode 100644 index 0000000..f769472 --- /dev/null +++ b/assignment-07-googledrive-upload/4-operators-data-types.js @@ -0,0 +1,23 @@ +// Arithmetic Operators +let a = 10, b = 5; +console.log(`Addition: ${a + b}`); +console.log(`Subtraction: ${a - b}`); +console.log(`Multiplication: ${a * b}`); +console.log(`Division: ${a / b}`); + +// Comparison Operators +console.log(`Equal: ${a == b}`); +console.log(`Not Equal: ${a != b}`); +console.log(`Greater than: ${a > b}`); + +// Logical Operators +console.log(`AND: ${true && false}`); +console.log(`OR: ${true || false}`); +console.log(`NOT: ${!true}`); + +// Data Types +let str = "Hello"; // String +var boolean = true; // Boolean +let num = 42; // Number +let obj = { name: "John" }; // Object +console.log(`String: ${str}, Boolean: ${boolean}, Number: ${num}, Object: ${JSON.stringify(obj)}`); diff --git a/assignment-07-googledrive-upload/5-temperature-conversion.js b/assignment-07-googledrive-upload/5-temperature-conversion.js new file mode 100644 index 0000000..f34ba00 --- /dev/null +++ b/assignment-07-googledrive-upload/5-temperature-conversion.js @@ -0,0 +1,16 @@ +// Function to convert Celsius to Fahrenheit +function celsiusToFahrenheit(celsius) { + return (celsius * 9/5) + 32; +} + +// Function to convert Fahrenheit to Celsius +function fahrenheitToCelsius(fahrenheit) { + return (fahrenheit - 32) * 5/9; +} + +// Example usage +let celsius = 25; +console.log(`${celsius}°C = ${celsiusToFahrenheit(celsius)}°F`); + +let fahrenheit = 77; +console.log(`${fahrenheit}°F = ${fahrenheitToCelsius(fahrenheit)}°C`); diff --git a/assignment-07-googledrive-upload/6-registration-form.html b/assignment-07-googledrive-upload/6-registration-form.html new file mode 100644 index 0000000..757b75e --- /dev/null +++ b/assignment-07-googledrive-upload/6-registration-form.html @@ -0,0 +1,27 @@ + + + + Registration Form + + +

Registration Form

+
+ +

+ + +

+ + +

+ + +

+ + +
+ + diff --git a/assignment-07-googledrive-upload/7-table-example.html b/assignment-07-googledrive-upload/7-table-example.html new file mode 100644 index 0000000..8a81c29 --- /dev/null +++ b/assignment-07-googledrive-upload/7-table-example.html @@ -0,0 +1,26 @@ + + + + Table Example + + +

Sample Table

+ + + + + + + + + + + + + + + + +
NameAgeCity
John25New York
Jane30Los Angeles
+ + diff --git a/assignment-07-googledrive-upload/8-perfect-numbers.js b/assignment-07-googledrive-upload/8-perfect-numbers.js new file mode 100644 index 0000000..ae56682 --- /dev/null +++ b/assignment-07-googledrive-upload/8-perfect-numbers.js @@ -0,0 +1,19 @@ +// Function to check if a number is perfect +function isPerfect(num) { + let sum = 0; + for (let i = 1; i < num; i++) { + if (num % i === 0) { + sum += i; + } + } + return sum === num; +} + +// Function to find indices of perfect numbers in an array +function findPerfectIndices(arr) { + return arr.map((num, index) => isPerfect(num) ? index : -1).filter(index => index !== -1); +} + +// Example usage +let numbers = [6, 28, 12, 496, 8128, 7]; +console.log(`Indices of perfect numbers: ${findPerfectIndices(numbers)}`); diff --git a/assignment-07-googledrive-upload/9-validation.js b/assignment-07-googledrive-upload/9-validation.js new file mode 100644 index 0000000..64c8aa2 --- /dev/null +++ b/assignment-07-googledrive-upload/9-validation.js @@ -0,0 +1,26 @@ +// Function to validate email +function validateEmail(email) { + const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return regex.test(email); +} + +// Function to validate phone number (10-digit format) +function validatePhone(phone) { + const regex = /^\d{10}$/; + return regex.test(phone); +} + +// Function to validate password (at least 8 characters, one number, one special character) +function validatePassword(password) { + const regex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/; + return regex.test(password); +} + +// Example usage +const email = "test@example.com"; +const phone = "1234567890"; +const password = "Test@1234"; + +console.log(`Email valid: ${validateEmail(email)}`); +console.log(`Phone valid: ${validatePhone(phone)}`); +console.log(`Password valid: ${validatePassword(password)}`); diff --git a/assignment-07-googledrive-upload/Application_Development_Lab_Assignment.pdf b/assignment-07-googledrive-upload/Application_Development_Lab_Assignment.pdf new file mode 100644 index 0000000..5eb808d Binary files /dev/null and b/assignment-07-googledrive-upload/Application_Development_Lab_Assignment.pdf differ