Assignment -2
Date of submission:14-July-2026 before 10pm
Note: Create a pdf file with program and output and share in group.File name must be your name.
1. Print the sin series x-x^3/3!+x^5/5!....x^n/n! ( read n.)
2. In the above program read the value x and find the sum of the series.(Use factorial function from math)
3.Print the following patterns
*
* *
* * *
* * * *
1
1 2
1 2 3
1 2 3 4
The pyramid is given for n=4 do this for any n
4. Find the position of the largest digit in a number.( consider unique digits)
Eg: i/p : 546 largest digit=6 position =3
5.Positive integer is called an Armstrong number of order n if
abcd….x= a^n + b^n + c^n + d^n + …+x^n where n is the length of the number
Eg: 153 = 1^3 + 5^3+ 3^3 #153 is an Armstrong Number.
Eg:1634= 1^4+6^4+3^4+4^4#1634 is an Armstrong Number. Write a Python program to check whether the given number is an Armstrong Number.
6. Find the square root of a number using Newton’s method ( refer the text book/blog for reference)
7. Write a program that computes an investment report.
Analysis
The inputs to this program are the following:
An initial amount to be invested (a floating-point number)
A period of years (an integer)
An interest rate (a percentage expressed as an integer)
8. Check whether the given number is a Krishnamurti number (.Use factorial () function from math)
For example: 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145 is a Krishnamurthy Number
9. Print all prime numbers less than 1000.
10. Input a number and print it in words ( i/p:345 o/p: Three Four Five)

Comments
Post a Comment