CLASS PROGRAMS
a) Write a program that checks if a given number is an Armstrong number. An Armstrong
number for a given number of digits is a number that is equal to the sum of its digits each
raised to the power of the number of digits.
Example: 153 is an Armstrong number because 13 + 53 + 33 = 153
b) Write a program to determine if a given number is a Disarium number. A Disarium
number is a number in which the sum of its digits powered with their respective positions is
equal to the number itself.
Example: 135 is a Disarium number because 11 + 32 + 53 = 135
c) Write a program that checks if a given number is a Pronic number. A Pronic number is a
number that is the product of two consecutive integers.
Example: 12 is a Pronic number because it can be expressed as 3×4
d) Write a program to verify whether a given number is a Harshad (or Niven) number. A
Harshad number is an integer that is divisible by the sum of its digits.
Example: 18 is a Harshad number because 18÷(1+8)=2
e) Write a program to check if a given number is a Neon number. A Neon number is a
number where the sum of digits of the square of the number is equal to the number itself.
Example: 9 is a Neon number because 92 = 81 and 8+1=9
1.
1
21
321
4321
54321
2.
54321
4321
321
21
1
Q- WAP to print all prime numbers up to 100.
1. Write a Python program to check whether a given number is a prime number or not.
2. Write a Python program to display all prime numbers between two given numbers.
3. Write a Python program to count how many prime numbers are present in between 1
to 100.
[Link] a Python program to check whether a given number is a perfect number or not.
[Link] a menu-driven Python program to:
(a) Check whether a number is Prime
(b) Check whether a number is Perfect