Int randi1000 a random integer between 1 and times

Info icon This 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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern