engr1hw2 - 2 In the for loop the boundaries should be...

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

View Full Document Right Arrow Icon
Engineering 001 – hw 2 1. x log(x) ln(x) 25 1.39794 3.21888 2. x=10 a=50 b=97.6974 x=9 a=45 b=95.5002 x=8 a=40 b=93.4207 x=7 a=35 b=91.4748 x=6 a=30 b=89.6831 x=5 3. i=-2 m=-2 n=4 i=-1 m=-1 n=1 i=0 m=0 n=0 i=1 m=1 n=1 4. The result is 72 5. The errors are 1. In the for loop, i should be initially set equal to 1, not 2.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2. In the for loop, the boundaries should be i<8, not i>8. 3. x needs to be set with an initial value of 0. 4. x=+1 should be x+=1 5. In the for loop, the three parts should be separated by semicolons, not commas. The new output will be: The sum of integers 1 to 7 is 28...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online