14W-CF 02082011 Campos,Tyler HW4 58

14W-CF 02082011 Campos,Tyler HW4 58

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

View Full Document Right Arrow Icon
Matlab Code: clear;clc; R = 0; N = 0; c = 1; while c ==1; Number = input ('Enter a number: '); if Number > R; R = Number; N = N+1; else N = N+1; end c = input('Continue? 1 for yes, 0 for no: '); end fprintf('The largest entered number is %.2f of %.0f entered numbers.', R,N) Sample Run: Enter a number: 23 Continue? 1 for yes, 0 for no: 1 Enter a number: 45 Continue? 1 for yes, 0 for no: 1 Enter a number: 56 Continue? 1 for yes, 0 for no: 1 Enter a number: 67 Continue? 1 for yes, 0 for no: 1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Enter a number: 12 Continue? 1 for yes, 0 for no: 1 Enter a number: 65 Continue? 1 for yes, 0 for no: 1 Enter a number: 32 Continue? 1 for yes, 0 for no: 0 The largest entered number is 67.00 of 7 entered numbers Discussion: This problem was relatively easy and went very smoothly. I mixed up a variable at one point but it was easily fixed. 14W-CF 02/08/2011 Campos,Tyler HW4 5/8 Tuesday, February 08, 2011 4:05 AM HW4 Page 1...
View Full Document

Ask a homework question - tutors are online