Purchase Solution

C++ console program that uses recursive function sum_squares

Not what you're looking for?

Ask Custom Question

Write a recursive function sum_squares(int N) that computes the sum of squared, positive integers smaller than or equal to N.

Write a program that:
1) asks the user to enter an integer Q;
2) creates an array of Q integers;
3) fills all the array with, in position number j, the sum of squared integers up to j, as computed by the sum_squares() function;
4) prints the content of the array to the console.

Purchase this Solution

Solution Summary

Attached solution considers the "position number j" in the array as the "index j" in the array, but also provides partial guidance on what modifications you would need to make in the program, should you need to generate a table starting from 1 (instead of from 0).

Solution Preview

Please have a look at the attached 448169.cpp that will generate an output similar to following sample session.

Enter a positive integer : 4
0 0
1 1
2 5
3 ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.