HELP WITH AN ASSIGNMENT PLZ!! ITS DUE ON FRIDAY 18th MAY 2012

2. Write a program (sum of cubes.cpp) that executes the following instructions

(a) Prompts the user to enter a positive integer n
(b) Computes and prints the value of Z = ((n^2)(n+1)^2)/4
(c) Computes and prints the sum 1^3 + 2^3 + 3^3 + ... + n^3.
3. Write a program (multiplicationTable.cpp) that takes an integer n as input and
output the multiplication table of n into a file. Your output file should look for
instance like this:
Please enter an integer: 4
1 X 4 = 4
2 X 4 = 4
3 X 4 = 4
4 X 4 = 4
5 X 4 = 4
1
6 X 4 = 4
7 X 4 = 4
8 X 4 = 4
9 X 4 = 4
10 X 4 = 4
4. Write a for loop that prints out the numbers 5 to 100, counting by ves. 51015202530 ...95100
5. The aims of this question is to write a program root 2.cpp that computes an
approximation of sqrt(2) using the Newton-Raphson method for finding the root of the
quadratic equation (x2) -2 = 0. Starting with x0 = 1, it is easy to show that the
sequence xn defined by
x^n+1 =0.5x^n +1/x^n
converges to
p
2. Complete the following program
/*root_2.cpp*/
#inlcude<iostream>
using namespace std;
int main(int argc, char* argv[])
{
//Declare a variable called x to hold the result
...........................
//Initialize x to 1
...........................
/*Successively compute the first 10 values of the sequence xn
starting at x0 = 1.
*/
int n = 0;
while(n < 10)
{
//update the value of x
............................
//Print the values of n and x
...........................
//update the value of n
...........................
}
system("pause");
return 0;
}
2
Last edited on
Sucks to be you.
yeah i knw
What problem are you having?
question 3, multiplecation table and question 5
Topic archived. No new replies allowed.