Int randi1000 a random integer between 1 and times

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: times. Int = randi(1000); % a random integer between 1 and Times fprintf('%10.0f is integer number %.0f\n',Int,count) end Note that we’re not doing just 20 numbers here, but a number determined by user input. Note that we’re also printing the number ‘order’ in the list as well. Sample output on next page Engineering Engineering Education enter the number of integers to generate: 11 47 is integer number 1 98 is integer number 2 824 is integer number 3 695 is integer number 4 318 is integer number 5 951 is integer number 6 35 is integer number 7 439 is integer number 8 382 is integer number 9 766 is integer number 10 796 is integer number 11 How can we determine the max and min values listed? Could we average the numbers? Add the necessary decision structure to the previous code to determine Max and Min values. (on next slide) Engineering Engineering Education 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 thi...
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