CSE102 – Solved

$ 24.99
Category:

Description

Grading: This homework will be graded on the scale of 100.

Part 1. Your function will read X floats as coefficients of an Nth order polynomial from the command prompt and writes the polynomial in a pretty format. No sign replications should be allowed. “0” can be entered as input, but it should not be shown in the output.
𝑝(𝑥) = 𝑎𝑛𝑥𝑛 + 𝑎𝑛−1𝑥𝑛−1 + ⋯ + 𝑎1𝑥 + 𝑎0 Example 1:
Enter your polynomial [n a_n a_n-1 a_n-2 … a_0]: 2 1 -3 -4

p(x) = x^2 – 3x – 4

Example 2:
Enter your polynomial [n a_n a_n-1 a_n-2 … a_0]: 3 1 0 1 2

p(x) = x^3 + x + 2

Part 2.
Armstrong number is a number that is equal to the sum of cubes of its digits. For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers.
153 = (1*1*1)+(5*5*5)+(3*3*3)
(1*1*1)=1 – (5*5*5)=125 – (3*3*3)=27
So: 1+125+27=153

Palindrome number is a number that is same after reverse. For example 121, 34543, 343, 131, 48984 are the palindrome numbers.
Your function will read an integer from the command prompt and check if that integer is a palindrome number or an armstrong number or both.

Example 1:
Please enter an integer number : 370
Output > This number is only Armstrong number.

Example 2:
Please enter an integer number : 343
Output > This number is only Palindrome number.

Example 3:
Please enter an integer number : ???
Output > This number is both Palindrome and Armstrong number.

Example 4:
Please enter an integer number : 159
Output > This number does not satisfy any special cases

Part 3. Your function will read 2 integers from the command prompt, find the prime numbers between these integers and print their sum on the screen.

Example 1:
Please enter first integer number : 26
Please enter second integer number : 58
Output > Sum of prime numbers between 26 and 58 : 281

Example 2:
Please enter first integer number : 17
Please enter second integer number : 91
Output > Sum of prime numbers between 17 and 91 : 905

General Rules:

1. Obey and do not break the function prototypes that are shown on each part, otherwise, you will get zero from the related part.
3. Note that if any part of your program is not working as expected, then you can get zero from the related part, even it’s working in some way.
4. You can ask any question about the homework by using the forum in the Teams page of the course.

Reviews

There are no reviews yet.

Be the first to review “CSE102 – Solved”

Your email address will not be published. Required fields are marked *