0

Hey everyone, I just need a little help with a lottery program I have to make or class. I have to generate a 7 digit number and then using that number compare it to a guess the user enters. I need to award prizes for the following conditions.

if all numbers match $1000

if all even place numbers match $500

if all odd place numbers match $250

First and last digits match $100

Im using math.Random() to generate the number im just having issues getting the specific place values and comparing them to the answer, for example

if the user enters the number 4875297 and the lottery generates 7845397. Since all the even place numbers match (8, 5, 9) the user would win $500, but how do I select the specific place value to compare

Thanks for any help