Computers and Technology

Write a program to find and print the sum of the first n cubes in the following four ways.
declare a variable n and ask the user for a value. print the value of n.
1. send n to a method to compute sum1 = 1^3 + 2^3 + … + n^3
2. send n to a method to compute sum2 = n^2 (n + 1)^2 / 4
3. send n to a method to compute sum3 = (1 + 2 + … + n)^2 . this is (the sum of the first n integers)^2 .
4. compute sum4 = n (n +1)(2n + 1) / 4 + 2 ). you must program it this way without simplifying

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:40, plzhelpmeasap46
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, lailahussain99
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
image
Computers and Technology, 22.06.2019 18:30, lizz1228
Kto rozmawia z clamentain przez krótkofalówke w the walking dead w 4 epizodzie
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, hargunk329
Q13 what function does a security certificate perform? a. creates user accounts b. scrambles data c. identifies users d. creates password policies e. provides file access
Answers: 1
Do you know the correct answer?
Write a program to find and print the sum of the first n cubes in the following four ways.
de...

Questions in other subjects:

Konu
Mathematics, 23.04.2021 23:10
Konu
Mathematics, 23.04.2021 23:10
Konu
Arts, 23.04.2021 23:10
Konu
Physics, 23.04.2021 23:10