I need BASIC language progamming fot this question. Write a program to ask the u
ID: 3566820 • Letter: I
Question
I need BASIC language progamming fot this question.
Write a program to ask the user as to how many numbers they want to enter. your program should collect that many numbers from the user and find the smallest and Average of those numbers. For example, if the user says, he/she wants to enter 6 numbers, you should collect 6 numbers. You can accomplish this by looping 6 times, collecting one number each time you are in the loop. Hint1: You can use the while..wend loop to write this program Hint2: Study the program which calculates the largest of the 10 numbers.
Explanation / Answer
CLS
PRINT "How many numbers you want to enter : "
INPUT numbers
largest = 0
smallest = 0
average = 0
count = 0
PRINT "please enter "; numbers$ ; " numbers"
WHILE count < numbers
INPUT num
IF count = 0 THEN
largest = num
smallest = num
ELSE
IF largest < num THEN
largest = num
END IF
IF smallest > num THEN
smallest = num
END IF
average = average + num
END IF
count = count + 1
WEND
average = average / numbers
PRINT "The largest number is : " ; largest$
PRINT "The smallest number is : " ; smallest$
PRINT "The average is : " ; average$
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.