REC06+Problems+Set

REC06+Problems+Set - Introduction to Computers for...

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

Introduction to Computers for Engineers Recitation06 - Problems for students to attempt 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, and then do the same not using loops. 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, then attempt to do the same without the nest loop. 6)

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/24/2011 for the course ENGINEERIN 127 taught by Professor Finch during the Spring '08 term at Rutgers.

Page1 / 3

REC06+Problems+Set - Introduction to Computers for...

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

View Full Document
Ask a homework question - tutors are online