Day 5(3.MAY.19)

Problem set

  1. Factorial of a given number as a procedure Factorial(5) -> 120 Factorial (6) -> 720
  2. Procedure to generate multiplication tables. MT(3, 5, 7) -> 3 X 5 = 15 3 X 6 = 18 3 X 7 = 21
  3. 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
  4. Procedure to check if a given number is Prime and returns a Boolean value. IsPrime(7) -> True IsPrime(9) -> False
  5. Procedure to count the number of digits in a given number. CountDigits(123456) -> 6 CountDigits (0) -> 1
  6. 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)
        1. IsPerfect(3) -> False
        2. IsPerfect (6) -> True
  7. Procedure to generate the first N perfect numbers. GeneratePerfect(2) -> 6 28 GeneratePerfect (4) -> 6 28 496 8128

RESULT :

All the above programs have been worked out and saved here.