Week_9_LGS_Functions

Int randibig a random integer between 1 and num if

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

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

Unformatted text preview: s ‘Num' times. Int = randi(Big); % a random integer between 1 and Num if Int>Max Max = Int; elseif Int<Min Min = Int; end fprintf('%10.0f is integer number %.0f\n',Int,count) end fprintf('\n\nThe maximum integer is %.0f\n',Max) fprintf('The minimum integer is %.0f\n\n',Min) Note initialization requirements. Note if-elseif structure Engineering Engineering Education enter the maximum integer to enter the number of integers 910847 is integer number 3814639 is integer number 7346189 is integer number 2605422 is integer number 4479828 is integer number 1713129 is integer number 5750440 is integer number 1952580 is integer number 3872758 is integer number 5350958 is integer number be generated: 7654321 to generate: 10 1 2 3 4 5 6 7 8 9 10 The maximum integer is 7346189 The minimum integer is 1713129 What happened? Engineering Engineering Education clear;clc Max = 0; %initializing the smallest Max Big = input('enter the maximum integer to be generated: '); Min = Big; %initializing the largest Min Num = input('enter the number of integers to generate: '); for count=1:1:Num % go through t...
View Full Document

This note was uploaded on 01/28/2014 for the course ENGE 1114 taught by Professor Twknott during the Spring '06 term at Virginia Tech.

Ask a homework question - tutors are online