Sum of Two Numbers
Task: Write a function that takes two numbers and returns their sum.
Input Example: 5, 3
Expected Output: 8
Details: The function should simply add the two provided numbers and return the result.
Even or Odd Checker
Task: Create a function that checks if a given number is even or odd.
Input Example: 4
Expected Output: "Even"
Details: Use the modulus operator to determine if the number is divisible by 2. Return "Odd" if not.
Largest of Three Numbers
Task: Write a function that accepts three numbers and returns the largest one.
Input Example: 4, 9, 7
Expected Output: 9
Details: Compare the three numbers using conditional statements and return the maximum.
Simple Calculator
Task: Develop a function that accepts two numbers and an operator (+, -, *, /), then returns the result.
Input Example: 8, 2, "/"
Expected Output: 4
Details: Implement a switch or if-else chain to perform the correct arithmetic operation based on the operator provided.
Print Numbers Using a Loop
Task: Use a loop to print numbers from 1 to 10.
Input Example: No direct input (the loop range is defined in the code)
Expected Output: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Details: Use a for loop (or while loop) to iterate and print each number.
Multiplication Table Generator
Task: Write a function that takes a number and prints its multiplication table from 1 to 10.
Input Example: 5
Expected Output:
5 x 1 = 5
5 x 2 = 10
...
5 x 10 = 50
Details: Loop from 1 to 10 and display the multiplication result in a formatted string.
Celsius to Fahrenheit Converter
Task: Create a function to convert Celsius to Fahrenheit.
Input Example: 0
Expected Output: 32
Details: Use the formula: Fahrenheit = (Celsius * 9/5) + 32.
Find the Remainder
Task: Write a function that returns the remainder when one number is divided by another.
Input Example: 10, 3
Expected Output: 1
Details: Use the modulus operator (%) to calculate and return the remainder.
Compare Two Numbers
Task: Write a function that compares two numbers and prints which one is greater or if they are equal.
Input Example: 7, 7
Expected Output: "Both numbers are equal."
Details: Use conditional logic to compare the two numbers and print the appropriate message.
Positive, Negative, or Zero
Task: Write a function to determine if a number is positive, negative, or zero.
Input Example: -5
Expected Output: "Negative"
Details: Check the number and return a string that classifies it as positive, negative, or zero.
Count to 100
Task: Print numbers from 1 to 100 using a loop.
Input Example: No user input needed
Expected Output: A sequence of numbers from 1 to 100
Details: Use a loop to iterate through the numbers and print each one.
Print Even Numbers
Task: Using a loop, print all even numbers between 1 and 50.
Input Example: No user input needed
Expected Output: 2, 4, 6, ... , 50
Details: Iterate through numbers 1–50, check if each number is even, and print it if so.
Sum of Array Elements
Task: Given an array of numbers, calculate and return the sum of its elements.
Input Example: [1, 2, 3, 4, 5]
Expected Output: 15
Details: Loop through the array, add each element to a cumulative sum, and return that sum.
Repeat a String
Task: Write a function that takes a string and a number, then returns the string repeated that number of times.
Input Example: "Hi", 3
Expected Output: "HiHiHi"
Details: Use a loop or built-in method (like repeat()) to concatenate the string repeatedly.
Greeting Message
Task: Write a function that accepts a name as input and returns a greeting message.
Input Example: "Alice"
Expected Output: "Hello, Alice!"
Details: Use string interpolation or concatenation to return a personalized greeting.