Day 5(3.MAY.19)
Problem set
Problem set
- Factorial of a given number as a procedure Factorial(5) -> 120 Factorial (6) -> 720
- Procedure to generate multiplication tables. MT(3, 5, 7) -> 3 X 5 = 15 3 X 6 = 18 3 X 7 = 21
- Procedure to print the list of factors of a given number. FactorList(6) -> 1 2 3 6 FactorList (9) -> 1 3 9 FactorList (19) -> 1 19
- Procedure to check if a given number is Prime and returns a Boolean value. IsPrime(7) -> True IsPrime(9) -> False
- Procedure to count the number of digits in a given number. CountDigits(123456) -> 6 CountDigits (0) -> 1
- Procedure to check if a given number is a Perfect Number. ( Perfect number is a number for which the sum of all it's divisors is equal to the number itself)
IsPerfect(3) -> False
IsPerfect (6) -> True
- Procedure to generate the first N perfect numbers. GeneratePerfect(2) -> 6 28 GeneratePerfect (4) -> 6 28 496 8128
RESULT :
RESULT :
All the above programs have been worked out and saved here.