Question 1 While Loop Armstrong Number

Check if a Number is Armstrong or Not

Write a Python program using a while loop to check whether a given integer is an Armstrong number (where the sum of each digit raised to the power of total digits equals the number itself).

Solution Code Screenshot Click image to zoom
Armstrong Number Solution
Question 2 While Loop Palindrome

Check if a Number is a Palindrome Number

Write a Python program using a while loop to reverse the digits of an integer and determine whether it is a palindrome (reads identically forwards and backwards).

Solution Code Screenshot Click image to zoom
Palindrome Number Solution
Question 3 While Loop Perfect Number

Check if a Number is a Perfect Number

Write a Python program using a while loop to find all proper divisors of a number and check whether their sum equals the number itself (e.g., 6, 28).

Solution Code Screenshot Click image to zoom
Perfect Number Solution
Question 4 While Loop Prime Number

Check if a Number is a Prime Number

Write a Python program using a while loop to check whether a given integer is a prime number (has no divisors other than 1 and itself).

Solution Code Screenshot Click image to zoom
Prime Number Solution
Question 5 While Loop Even Odd Count

Count Even and Odd Digits in a Number Separately

Write a Python program using a while loop to extract digits from a number and count how many even digits and odd digits are present.

Solution Code Screenshot Click image to zoom
Count Even Odd Digit Separately Solution
Question 6 While Loop Digit Count

Count Total Digits in a Number

Write a Python program using a while loop and floor division (// 10) to count the total number of digits in an input integer.

Solution Code Screenshot Click image to zoom
Count the Digit Solution
Question 7 While Loop GCD

Find GCD (Greatest Common Divisor) of Two Numbers

Write a Python program using Euclidean algorithm in a while loop to calculate the Greatest Common Divisor GCD of two numbers.

Solution Code Screenshot Click image to zoom
Find GCD Solution
Question 8 While Loop Digit Extremes

Find Largest and Smallest Digit in a Number

Write a Python program using a while loop to examine each digit of an integer and display both the largest and smallest digit found.

Solution Code Screenshot Click image to zoom
Find Largest Smallest Digit Solution
Question 9 While Loop Power / Exponent

Calculate m^n (m to the power of n) Without Math Module

Write a Python program to compute m raised to the power n using repeated multiplication inside a while loop without using math.pow or the ** operator.

Solution Code Screenshot Click image to zoom
Find m^n Without Math Solution
Question 10 While Loop Sentinel Accumulator

Sum Positive, Negative, and Odd Numbers from User

Write a Python program to continuously accept numbers from the user in a while loop until a sentinel value is entered, calculating separate sums for positive, negative, and odd numbers.

Solution Code Screenshot Click image to zoom
Positive Negative Odd Sum Solution
Question 11 While Loop Digit Printing

Print Each Digit of a Number on a New Line

Write a Python program using a while loop to extract and print each individual digit of an input integer on a separate line.

Solution Code Screenshot Click image to zoom
Print Digit New Line Solution
Question 12 While Loop Factorial

Calculate Factorial of a Number Using While Loop

Write a Python program to read an integer and compute its factorial using a while loop.

Solution Code Screenshot Click image to zoom
Print Factorial Solution
Question 13 While Loop Buzz Number

Print First N Buzz Numbers

Write a Python program to print the first N buzz numbers (numbers divisible by 7 or ending in 7) using a while loop.

Solution Code Screenshot Click image to zoom
First N Buzz Number Solution
Question 14 While Loop Prime Factorization

Find and Print Prime Factors of a Number

Write a Python program using a while loop to find and display all prime factors of a given number.

Solution Code Screenshot Click image to zoom
Print Prime Factor Solution
Question 15 While Loop Reverse Number

Reverse a Number Using While Loop

Write a Python program to reverse any given integer numerically using modulo and division inside a while loop.

Solution Code Screenshot Click image to zoom
Reverse Number Solution
Question 16 While Loop Spy Number

Check if a Number is a Spy Number

Write a Python program using a while loop to determine if a number is a Spy Number (where the sum of all digits equals the product of all digits, e.g., 1124).

Solution Code Screenshot Click image to zoom
Spy Number Check Solution
Question 17 While Loop Sum of Digits

Calculate Sum of Digits of a Number

Write a Python program using a while loop to extract each digit of an integer and compute their total sum.

Solution Code Screenshot Click image to zoom
Sum of Digit Solution
Question 18 While Loop Sum Even Odd Digits

Sum Even and Odd Digits of a Number Separately

Write a Python program using a while loop to extract all digits of an input number and calculate the sum of even digits and the sum of odd digits separately.

Solution Code Screenshot Click image to zoom
Sum of Even Odd Digit Separately Solution
Question 19 While Loop

Repeatedly Accept Numbers Until a Prime Number is Entered

Write a Python program that repeatedly prompts the user to input an integer until a prime number is entered.

Solution Code Screenshot Click image to zoom
Accept num until prime num entered
Question copied to clipboard!