Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please program in C++ Program 4. Write a function: double zeta( double x) // here x must be > 1.0 to compute and return the

Please program in C++

image text in transcribed

Program 4. Write a function: double zeta( double x) // here x must be > 1.0 to compute and return the value of the sum Note that n is not a parameter of the function. Your while loop should stop adding once the term 1/k" becomes smaller than 10 parameter n and print the zeta value 10 Then in main function use a while loop to read values of the Program 5. Write a function int arithmeticsum( unsigned int a, unsigned int k, unsigned int n) to compute and return the value of the sum of the first n terms of an arithmetic sequence: a, a + k, a + 2k, . . . a + (n-1): where a and k are positive integers. The main function use a while loop to read values a, k, n and rint the sum with each iteration Program 6. Using the function: bool isprime( unsigned int n ) write a program to construct a vector of the first n prime numbers. Your program should 1. read in 2. use a while loop starting with 2 and with each iteration going up by one. 3. if a number is prime, add it to the vector; 4. finish the loop once n primes have been added. 5. Print the vector in the following fashion: supposing that n -10 your code should print primes[10]-2, 3, 5, 7, 11, 13, 17, 19, 23, 29)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions