- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsample.lua
More file actions
Latest commit
18 lines (15 loc) · 407 Bytes
/
Copy pathsample.lua
File metadata and controls
18 lines (15 loc) · 407 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- Function to check if a number is even or odd
functioncheckEvenOrOdd(number)
ifnumber%2==0then
return"even"
else
return"odd"
end
end
-- Get user input
print("Enter a number: ")
userInput=io.read("*n") -- Reads a number from user input
-- Check if the number is even or odd
result=checkEvenOrOdd(userInput)
-- Output the result
print("The number is " ..result)