14-440-127 Recitation 6 Problems

14-440-127 Recitation 6 Problems - 14:440:127 Introduction...

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

View Full Document Right Arrow Icon
14:440:127- Introduction to Computers for Engineers Problems for students to attempt in Recitation 6 1) Write a for loop that calculates 20! (20 factorial). You may not use the factorial( ) function. 2) Write a while loop that continually asks the user to input a number. Each time he/she enters a positive number, you should display that number to the screen. Once the enter a number that’s not positive, the loop should stop, and you should display “Loop Stopped” to the screen. 3) Write a for loop that calculates the sum of the prime numbers from 1 to 1000. 4) Write a while loop that finds the smallest 8 digit prime number. Then, instead write that loop as a for loop (using the break command). 5) Use the following command to create a 10x10 matrix: C = round(500*rand(10)); Write a nested for loop that finds the maximum value in that matrix. 6) Write a loop that creates the following matrix. Notice that the first row is 1*[4 8 12], the second row is 2*[4 8 12], the third row 3*[4 8 12], etc. 4
Background image of page 1

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

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

This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.

Page1 / 2

14-440-127 Recitation 6 Problems - 14:440:127 Introduction...

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