answersLogoWhite

0

It's a bit difficult to show a flowchart using nothing but words, but here goes:

start

let list[] be 100 random values

let best be value of list[0]

let index be 1

repeat

is value of list[index] less than best?

YES: let best be value of list[index] {continue}

NO: {continue}

increment index

is index less than 100?

YES: {go to repeat}

NO: {continue}

print value of best

end

Previous answer:

start test number =100 count = count +1 list number =< test number if true testnumber = list number count = 100 goto end else start end

The previous answer assumes 100 to be largest number in the list. What happens when all of the numbers in the list happen to be greater than 100? Also, previous answer exits the loop prematurely as soon as any number equal or smaller than 100 is located. To locate the smallest number in a list, the entire list must be compared with the current best, which is initially taken to be the first number in the list.

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

How do you make an input program that computer can determine the highest number?

Here it is in Java for 5 numbers: (adapt for your programming language) import java.util.Arrays Public class Highestnumber { public static void main (String args[]) { Scanner input = new Scanner( System.in ); int numberofinputs = 5; //make an array to hold the numbers int numbers[] = new Int[numberofinputs]; for (x=0;x&lt;numberofinputs;x++) { System.out.print("Please input a number: "; numbers[x] = input.nextInt(); } //Sorts Numbers from least to greatest Arrays.sort(numbers[]); //gets highest number int highestnum = numbers[numberofinputs-1] //displays highest number System.out.println("The highest number is:" + highestnum); } }


Even number program?

bool is_even(long int num) { return !(num &amp; 1); //when the number is even(divisible by two), //its least significant bit is 0 }


What does product of a number mean?

There is no such thing as the product of just one number, a product is when 2 or more numbers are multiplied. The product of a number and another number means the answer you get when you multiply the two.


Write a program that takes 5 numbers 1 to 10 from user and then prints the number of distinct values?

The simplest solution is to use a std::set&lt;size_t&gt; sequence container to store the values as they are input. Duplicate entries are ignored automatically, thus when all 5 numbers have been input, the set will have at least 1 number but no more than 5. Thus the size of the set represents the count of distinct values that were input.


How do you write a looping program to check whether input is a buzz number or not?

Buzz numbers are aircraft identification numbers that were applied to American aircraft following the second world war and through the 1960's. To determine if an input is a buzz number or not, the input must consist of a two- or three-letter manufacturing code and a 3-digit number, separated by a hyphen. The digits are generally the last three digits of the aircraft serial number. Validating the manufacturing code is relatively simple given there were only 173 issued. However, validating the three-digit code would be impossible without a complete list of all aircraft that were assigned a buzz number. If such a list exists, storing them in sequential order would allow your program to perform a fast binary search to determine if the input were valid or not. In the absence of such a list, the manufacturing code alone would at least tell you which type of aircraft the buzz number (if valid) would have applied to.