answersLogoWhite

0


Best Answer

Store the numbers in a suitable container such as an array. Assume the first number is the smallest and assign its value to a local variable. Traverse the remainder of the sequence, comparing each element's value to the stored value. If an element has a lower value, assign its value to the local variable. When the sequence is fully traversed, the local variable will hold the value of the smallest value in the sequence. Return that value.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you find the smallest value in a set of numbers in qbasic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write the program in qbasic and add two numbers?

Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end


Find smallest no in matrix in c plus plus?

Store the first value in the matrix, then compare every value in the matrix with the stored value, replacing the stored value if the current value is smaller. For instance, the following snippet will locate the smallest int value in a 3x4 matrix named A: int smallest=A[0][0]; for(int x=0; x<3; ++x ) { for(int y=0; y<4; ++y ) { if(A[x][y]<smallest ) { smallest=A[x][y]; } } }


Write a program that will find the smallest largest and average values in a collection of N numbers Get the value of N before scanning each value in the collection of N numbers?

#include #include #include int main(int argc, char *argv[]){int n, smallest, largest, sum, temp;if(argc < 2){printf("Syntax: foo val1[val2 [val3 [...]]]\n");exit(1);}smallest = largest = sum = atoi(argv[1]);for(n = 2; n < argc; n++){temp = atoi(argv[n]);if(temp < smallest) smallest = temp;if(temp > largest) largest = temp;sum += temp;}printf("Smallest: %i\nLargest: %i\nAverage: %i\n", smallest, largest, sum / (argc - 1));return 0;}


How do you write a qbasic program to find area and circumerence of a circle?

Write a program that calculates the area of a triangle in QBASIC


How do you write a recursive procedure that returns the smallest value in an array of 10 elements?

The operation you describe is not a recursive one, it is iterative (linear in nature). It's also better to return the index of the smallest value rather than just the value itself. In this way we know the position of the smallest value as well as the value itself. To find the smallest element in an array, we start with the first element. Being the only value encountered so far, it must be the smallest, so we store its index. We then compare the value at the stored index to that of each of the remaining elements, one by one. When we find a smaller value, we update the stored index, because that value is the smallest encountered so far. When we reach the end of the array, the stored index will tell us which element was the smallest, so we simply return that index. The algorithm can (and should) be generalised to cater for arrays of any length. // Returns the index of the smallest value in array a of length n int smallest (const int* const a, int n) { if (n&lt;1) return -1; // sanity check: the array must have 1 or more elements to be valid int i, j; i = 0; // assume first element holds smallest value until proven otherwise for (j=1; j&lt;n; ++j) if (a[j] &lt; a[i]) i = j; // update i each time a smaller value is found at index j return i; // a[i] holds the smallest value in the array } int main (void) { const int max = 10; int a[max] = {5, 4, 6, 3, 0, 7, 2, 8, 1, 9}; int i; i = smallest (a, max); assert (i==4); // a[4] holds the smallest value return 0; }

Related questions

How do you find range in decimal?

The range is the largest value minus the smallest value from a set of numbers.


How do you find large and small value from 10 numbers?

its easy.. just compare all the numbers you will find the largets and the smallest one.


How do you find the product of five numbers in Qbasic?

Most computer languages use the asterisk, "*", for multiplication.


What is the median in a set of numbers?

to find the median in a set of numbers you have to order them from the smallest to the largest and find the middle value e.g. 2,4,3,7,1 1,2,3,4,7 the median is 3


How do you find the mid value in statistics?

The middle or mid value is easy to find....it is what it sounds like. If you have a group of numbers, you identify the largest and smallest, and then calculate the halfway point (largest # - smallest #). Then, from your group of numbers, identify the number closest to the number you came up with. If you are seeking a mid value from only two numbers, just subtract the smaller from the larger number and that's your answer.


Can 0 be used to find the range in a group of numbers?

If 0 is the smallest value in your data, then yes use zero to find the range.


How do you find the range of seven numbers?

You can find the range of any set of numbers by subtracting the smallest value from the largest value, eg. in the set 1, 3, 5, 6, 7, 8 the range would be 8-1, or 7.


Why do you subtract to find the range?

The range is the distance from the smallest value to the largest value. This is equivalent to the largest value MINUS the smallest value. Therefore you subtract.


What are the smallest and biggest numbers you can find for a line of longitude?

The smallest is 0o0'0'' and the largest is 180o0'0''


Find the two smallest numbers whose GCF is 7 and whose LCM is 98?

the two smallest numbers are 49 and 14


How do you find the median value on a cumulative frequency?

set all you numbers up in order from smallest to largest. then find the middle. if there are two number in the middle, add them up and divide by two. Example: set of numbers - 8,6,3,4,10,15,36 put in order from smallest to largest - 3,4,6,8,10,15,36 now find the middle number - 8 8 is then my median of this sequence


How to find the smallest number?

When you are given some numbers just arrange them in ascending order and you will the smallest number which can be made out of those given numbers.