Sale!

CSL-101 Computer Programming (Assignment – 5) solved

$40.00 $24.00

Category:

Description

5/5 - (1 vote)

Q.1 Write a Python program for printing Fibonacci series for ‘n’ terms.
Q.2 Write a Python program to Reverse a Given Number.
Q.3 Write a Python program to Check if a Number is a Palindrome. A number is
Palindrome if it equals to its reversed number.
Q.4 Write a Python program to find the LCM of two numbers.
Q.5 Write a Python program to check whether a number is a strong number or not. A
number is called a strong number if the sum of the factorials of its digits is equal to
the number itself. For example: 145 is strong because 1! + 4! + 5! = 1 + 24 + 120 =
145.
Q.6 Write a Python program to check if two numbers are amicable numbers. Amicable
numbers are two different numbers so related that the sum of the proper divisors of
each is equal to the other number. For example, 220 and 284 are amicable because
the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, of which the
sum is 284; and the proper divisors of 284 are 1, 2, 4, 71 and 142, of which the sum
is 220.
Q.7 Write a Python program to check if a given number is a Fibonacci number or not.
Make use of following hint. Hint: A number is a Fibonacci number if either 5n2
+ 4
or 5n2
– 4 is a perfect square.
Q.8 Write a Python program to print the Collatz sequence. The Collatz sequence is
defined as: start with a number n. The next number in the sequence is n/2 if n is even
and 3n + 1 if n is odd. Repeat above steps, until it becomes 1.
For example, The Collatz sequence for n = 6 should print 6, 3, 10, 5, 16, 8, 4, 2, 1.