Worksheet 3
Worksheet 3
3. Write a program that accepts an integer number (input) form the user and 14. Create a dice game that uses two six-sided dice. Each time the program runs,
checks the given number is odd or even. (Text Book) use random numbers to assign values to each die variable. Output a “Player Wins”
message to the user if the sum of the two dice is 7 or 11. Otherwise output the sum
4. Write a program that accepts an integer number (input) form the user and of the two dice and thank the user for playing.
checks the given number is a prime number or not. (Text Book)
5. Write a Program that calculates the Net Salary, deducting Tax & Pension from
Gross Salary.
8. Write a Program that displays Greatest Common Factor (GCG) of two numbers.
(Text Book)
10. Write a Program that display the reverse of digits. (Text Book)
11. Build a number guessing game that uses input validation [ isdigit() function ]
to verify that the user has entered a digit and not a non-digit (letter). Store a
random number between 1 and 10 into a variable each time the program is run.
Prompt the user to guess a number between 1 and 100 and alert the user if the user