Skip to content

Ilgizsabu/lucky-ticket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Lucky-ticket

The project is a program to determine if a tram ticket is lucky according to two systems: the Moscow system and the Saint Petersburg system.

  1. Input: The user enters a ticket number with 6 digits.
  2. Moscow system: The ticket is lucky if the sum of the digits in the first half of the number equals the sum of the digits in the second half.
  3. Saint Petersburg system: The ticket is lucky if the sum of the digits in the odd positions equals the sum of the digits in the even positions.
  4. Super ticket: The ticket is lucky according to both systems.

The program does not use loops or string slicing to perform the checks.

Проект представляет собой программу для определения того, является ли трамвайный билет счастливым, в соответствии с двумя системами: московской и петербургской.

Входные данные: Пользователь вводит номер билета, состоящий из 6 цифр. Московская система: Билет является счастливым, если сумма цифр в первой половине номера равна сумме цифр во второй половине. Санкт-Петербургская система: Билет счастливый, если сумма цифр в нечетных позициях равна сумме цифр в четных позициях. Супербилет: Билет является счастливым в соответствии с обеими системами. Программа не использует циклы или нарезку строк для выполнения проверок.