Dsa
Math
Easy
Lucky Number Check
Create a program that checks if a given integer is a 'lucky number'. A lucky number is defined as a number that, when divided by 7, leaves a remainder of 3. The program should read integers until a '-1' is encountered, then return the count of lucky numbers.
Input:
A sequence of integers ending with -1.
Output:
The count of lucky numbers in the input sequence.
Example:
Input:
10
3
17
-1
Output:
1
Key concepts
moduloconditionals
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now