lab09hw-nested-for - different LCV from 0 to 4. First...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework Program: Nested Loops Key Concept: nested loops Write a C++ program to produce the following output: 0*0 0*1 0*2 0*3 0*4 Sum of products in this row: 0 1*0 1*1 1*2 1*3 1*4 Sum of products in this row: 10 2*0 2*1 2*2 2*3 2*4 Sum of products in this row: 20 3*0 3*1 3*2 3*3 3*4 Sum of products in this row: 30 4*0 4*1 4*2 4*3 4*4 Sum of products in this row: 40 Do this by having an outer loop that runs an LCV from 0 to 4. Nest another (inner) loop inside that runs a
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: different LCV from 0 to 4. First figure out how to print the products. Once you've done so, your goal is to compute and add up the products in each row. Before you write code to do this, verify the arithmetic by hand so you know what to expect. Use a sum variable like you did in Lab 8. Think very carefully about where you zero it. Print out: Your code A sample run A brief discussion Keep this homework in your notebook with your other programs....
View Full Document

Ask a homework question - tutors are online