Question
Python programs 4.Write a program that adds up the squares and adds up the cubes of integers from 1 to N, where N is entered
Python programs
4.Write a program that adds up the squares and adds up the cubes of integers from 1 to N, where N is entered by the user: Upper Limit: 5 The sum of Squares is 55 The sum of Cubes is 225 Do this by using just one loop that generates the integers. Of course, if you really needed to calculate these sums you would use the appropriate formulas:
Add these formulas to your program and print out their results as well as that of the explicit summations.
5. Write a program that computes X N where X is a floating point number and N is a positive integer. The program informs the user that N must be positive if the user enters a negative value. Of course, X N = X * X * X * ... * X -------------------- N times The user dialog will look something like this: Enter X 1.3 Enter N 5 1.3 raised to the power 5 is: 3.71293 ------- Enter X 5.6 Enter N -3 N must be a positive integer.
12 + 2? + 32 + ... + n = n(n+1)(2n+1)/6 1 + 2 + 3 + ... + n = n(n+1)/4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started