and has been o Q3: Sequence Sum: write a tul Ct program Assignmenis mathematical
ID: 3756514 • Letter: A
Question
and has been o Q3: Sequence Sum: write a tul Ct program Assignmenis mathematical sequence thai prints terms or ue Tollowing 2 3 4 5 6 also written as Your program should accept a real number from the user representing a limit, and should add and print terms of the sequence until the sum of terms meets or exceeds that limit. For example, if your user enters 2.0, program prints terms until the sum of those terms is at 2 2.0. You should round your answer to 3 digits past the decimal point (Do some research) The following is the output from the program execution when 2.0 is entered by the user ( 2.0) 1 + 1/2+ 1/3 + 1/4= 2.083 spite the fact that the terms keep getting smaller, the sequence can actually produce an arbitrarily be produced. You must match the output format shown exactly; note the spaces and pluses separating large sum if enough terms are added.) If your program reads a value less than 1.0, no output should neighboring terms. Other sample calls nput 0.0 1.0 1.5 Output 1 1 .000 1 + 1/2= 1.500Explanation / Answer
#include #include using namespace std; int main() { double num, sum = 0; int i = 1; cin >> num; if(num > 0) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.