This is a simple webpage layout example.
// A basic calculator program
function calculate(operation, num1, num2) {
switch (operation) {
case "add":
return num1 + num2;
case "subtract":
return num1 - num2;
case "multiply":
return num1 * num2;
case "divide":
return num1 / num2;
default:
return "Invalid operation!";
}
}
console.log(calculate("add", 5, 3)); // Output: 8
import random
def guess_the_number():
number_to_guess = random.randint(1, 100)
attempts = 0
print("Guess the number (between 1 and 100):")
while True:
user_guess = int(input("Enter your guess: "))
attempts += 1
if user_guess < number_to_guess:
print("Too low!")
elif user_guess > number_to_guess:
print("Too high!")
else:
print(f"Correct! You guessed it in {attempts} attempts.")
break
guess_the_number()
Welcome to My Webpage
This is a simple webpage layout example.