LabAssignment7part1 - num3 =-2.3 while(num3<= 2.9 cout<< num3<<"" this statement does the math for the negative numbers

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 /* Lab assignment 7 part 1 Kasey Scott [email protected] This code first shows even number in a range with only 6 per line. Then increments a number adding the negative and the postive values. Then make a loop that does a multiplication table*/ #include <iostream> int main () { cout << "CSE 1020 Lab 7 Pgm 1 Kasey Scott [email protected]" << endl // declaring all the variables int num1, num2, num4, num5, produc double num3, posit, negat // first part num1 = 100 num2 = 1 // loop that will show even numbers while (num1 <= 150) { cout << num1 << " " num1 += 2 num2++ // This statement make a new line after 6 numbers if (num2 > 6) { cout << endl num2 = 1 }// end of if statement }// end of while loop cout << endl << endl // This is the start of the second instructions. // Make a range and add the values that are negative and positive.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: num3 = -2.3 while (num3 <= 2.9 ) { cout << num3 << " " // this statement does the math for the negative numbers if (num3 < 0.0) { Sheet1 Page 2 negat += num3 }// end if statement if ( num3 > 0.0) { posit += num3 }//end else if statement num3 += 0.4 }// end while loop cout << endl cout << "Sum of negative values: " << negat << endl cout << "Sum of positive values: " << posit << endl cout << endl << endl // The last instruction. This loop will make a multiplication table num4 = 1 while (num4 <= 10) { num5 = 1 // nested loop to make the matrics for the table. while (num5 <= 10) { produc = num4 * num5 if (produc <= 10) cout << " " cout << produc << " " num5++ }// end nested loop cout << endl num4++ }//end while loop return 0 }// end program...
View Full Document

This note was uploaded on 03/05/2010 for the course DSDDDDDDD dddddfvvc taught by Professor Cxcseef during the Spring '10 term at École Normale Supérieure.

Page1 / 2

LabAssignment7part1 - num3 =-2.3 while(num3<= 2.9 cout<< num3<<"" this statement does the math for the negative numbers

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online