Founding Batch Offer · HLD · LLD · System Design at ₹799 until 30 Nov

ProgramsLogic building

Phase 2 - Level 2: Number-based Looping Logic

Apply loops to solve number manipulation problems.

14 programs · open one, then the next

Start with Count Digits in a Number
  1. 01Count Digits in a NumberIntermediateCount decimal digits in an integer by repeatedly dividing by ten. Students trace a Python while loop, ignore a negative sign, and handle zero as one digit.Open example →
  2. 02Reverse a NumberIntermediateReverse an integer with arithmetic rather than slicing text. Students trace place-value rebuilding, negative-sign restoration, and the loss of trailing zeros.Open example →
  3. 03Check Palindrome NumberIntermediateCheck an integer palindrome with a digit-reversal loop. Students preserve the original magnitude, build its reverse, and compare numeric values after the loop.Open example →
  4. 04Sum of DigitsIntermediateAdd the decimal digits of an integer with Python modulo and floor division. Students follow a running total, a shrinking copy, and sign-independent digit sums.Open example →
  5. 05Armstrong Number CheckIntermediateCheck Armstrong numbers using the number of digits as the power. Students trace two Python digit loops and distinguish exponentiation from bitwise XOR.Open example →
  6. 06Perfect Number CheckIntermediateTest whether a positive integer equals its proper-divisor sum. A lesson on excluding the number itself, accumulating factors, and perfect-number boundaries.Open example →
  7. 07Print Primes Between 1-100IntermediateList primes from two through one hundred with nested loops. Students trace a fresh candidate flag, square-root bounds, and early exit after finding a factor.Open example →
  8. 08Check if Number is PrimeIntermediateDetermine whether one integer is prime with Python. Students reject numbers below two and trace trial division, a flag, and the square-root stopping bound.Open example →
  9. 09Fibonacci Series Up to NIntermediatePrint a number of Fibonacci terms with Python. Students handle short sequences first, update two previous terms, and separate a term count from a value limit.Open example →
  10. 10Sum of First N Fibonacci TermsIntermediateAdd the first n Fibonacci terms without storing a list. Students trace the starting pair, a running total, and the difference between terms and their sum.Open example →
  11. 11Product of Digits with an Explicit Zero CaseIntermediateCalculate digit products with an explicit zero branch. Students contrast empty-loop behavior with a valid zero result while preserving negative-input handling.Open example →
  12. 12Strong Number Check with Recursive FactorialsIntermediateRecognize strong numbers with a recursive factorial helper. Students trace digit factorials, recursion's base case, and the positive-input check for zero.Open example →
  13. 13Harshad Number CheckIntermediateCheck divisibility by a number's digit sum with Python. Students trace Harshad logic, absolute values, and a guard that prevents a zero-divisor error.Open example →
  14. 14Abundant Number CheckIntermediateFind whether proper divisors sum to more than a positive integer. Students use a factor loop to distinguish abundant numbers from perfect and deficient ones.Open example →