C# code challenge

1️⃣ FizzBuzz with a Twist

Write a program that prints numbers from 1 to 100, but:

  • Replace multiples of 3 with “Fizz”.
  • Replace multiples of 5 with “Buzz”.
  • Replace multiples of both 3 and 5 with “FizzBuzz”.
  • Add a twist: also replace multiples of 7 with “Zap” (e.g., 21 becomes “FizzZap”).

2️⃣ Prime Number Detector

Write a program that asks the user for a number and checks if it’s a prime number.

  • If it’s prime, display "Prime".
  • If not, display "Not Prime" and show its smallest divisor.

3️⃣ Factorial Finder

Write a program to calculate the factorial of a number entered by the user.

  • For example, if the user enters 5, the output should be 5! = 120.

4️⃣ Number Guessing Game

Create a simple number guessing game where:

  • The program generates a random number between 1 and 50.
  • The user has 5 attempts to guess the number.
  • After each guess, provide feedback: “Too High” or “Too Low”.
  • If the user fails, display the correct number.

5️⃣ Fibonacci Calculator

Write a program that prints the first n Fibonacci numbers, where n is entered by the user.

  • For example, if n = 7, the output should be: 0, 1, 1, 2, 3, 5, 8.

Leave a Comment