Skip to content

Instantly share code, notes, and snippets.

@ehlzi
Created February 20, 2024 05:06
Show Gist options
  • Select an option

  • Save ehlzi/912b5b5ece8c551bdf39a6bf30a59e0f to your computer and use it in GitHub Desktop.

Select an option

Save ehlzi/912b5b5ece8c551bdf39a6bf30a59e0f to your computer and use it in GitHub Desktop.
Module main();
// This module provides a simple addition math quiz
Declare Integer number1, number2, userAnswer, correctAnswer;
// Generate two random numbers
number1 = Random(1, 100); // Random number between 1 and 100
number2 = Random(1, 100); // Random number between 1 and 100
correctAnswer = number1 + number2; // Calculate the correct answer
// Display the quiz question
Display "What is ", number1, " + ", number2, "?";
Input userAnswer; // Get user's answer
// Check if the user's answer is correct
If userAnswer = correctAnswer Then
Display "Congratulations! That's the correct answer.";
Else
Display "Incorrect. The correct answer is ", correctAnswer;
End If
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment