Skip to content

BorbiukR/LuckyTicket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LuckyTicket

searching...

Сonsole application that determines if the ticket number entered by the user is lucky $$$. The ticket number is a number that can be 4 to 8 digits long. If the user entered a number that contains an odd number of digits, then 0 must be added at the beginning of the ticket number. A ticket is considered lucky if the sum of its first half is equal to the sum of the second half.

Example

enetered number - 12056
this is an odd number, so we add 0 at the beginning of the ticket number - as a result we get - 012056

divide into two halfs:
1st half - 012
2nd half - 056

count the sum of the digits of each half:
1st half - 0 + 1 + 2 = 3
2nd half - 0 + 5 + 6 = 11

then check the equality of the 1st and 2nd half : 3 = 11 ?
3 is not equal to 11, so the ticket is not lucky

Application Start

When you double click run.bat file, the program build and starts.
Then you have the option to play by pressing the key [P] or to exit the program by pressing [E]

About

test task for selection for courses

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published