-
Fizz Buzz Solution: For a given number, if it is divisible by 3, print “Fizz”. If it is divisible by 5, print “Buzz”. If it is divisible by both 3 and 5 print “FizzBuzz”.
-
Math Riddle Solution: Solve a given equation (e.g. 3 + 5 = ?) and print the answer (e.g. 8).
-
Converting Celsius to Fahrenheit Solution: To convert Celsius to Fahrenheit, use the formula F = (C x 9/5) + 32.
-
Triangle Area Solution: Calculate the area of a triangle using the formula A = 1/2 bh.
-
Palindrome Solution: A palindrome is a word or phrase that is read the same forwards and backwards (e.g. madam). Check if a given word is a palindrome by comparing the first letter to the last letter, the second letter to the second last letter and so on until the first and last letters match.
-
Leap Year Solution: To determine if a given year is a leap year, check if divisible by 4 and not divisible by 100 or if divisible by 400.
-
Pattern Matching Solution: Comparing a given set of characters or numbers to a given pattern.
-
Sorting Numbers Solution: Sort a given list of numbers using a sorting algorithm such as Bubble Sort or Insertion Sort.
-
Reversing a Number Solution: Given a number, reverse the order of its digits. For example, given 12345, the output should be 54321.
-
Prime Number Solution: Check if a given number is a prime number or not by dividing it by any number between 2 and the square root of that number and checking if the remainder is 0 or not.
Loading...