Qbasic Program To Sort Numbers
Posted on by admin
Qbasic Program To Sort Numbers Average ratng: 4,7/5 107 reviews
- Qbasic Program To Sort Numbers Worksheet
- Qbasic Program To Sort Numbers In Ascending Order
- Qbasic Program To Sort Numbers Anchor Chart
- Qbasic Program To Sort Numbers Printable
- Qbasic Program To Sort Numbers Worksheets
Write a program to sort numbers in ascending order in QBasic. For example, Input 1 5 4 3 7 8 9 Output 1 3 4 5 7 8 9. First, the user enters the size of array. The only output necessary for this program is the median value. Using the sorting program we developed this chapter, change it so that the numbers generated range between 1 and 1000. Change the original sorting program so that it generates 150 items. Change the original sorting program so that the list is sorted in descending order.
I have a qbasic program that needs to be able to read names from a data file, print the names, then sort and print the names alphabetically. After the names are sorted, it outputs the names sorted alphabetically to a data file. Lastly, the program performs a search where the user enters a name to search and the program outputs if the name entered was found in the list of names or not.That?s an overview of what the program does, however I am stuck on one particular part and was hoping I can get some help here. I have everything working in the program as I want, except the sorting alphabetically section. To me it looks like the logic is correct in B020SortArray, however when the program prints the list of sorted names their not sorted alphabetically.
Here is the program logic if anyone would be willing to help me out:
I am also wondering if there is a more efficient way to do this(found in B020SortArray):
Code: Select all Avery label app for mac. /download-playstation-2-bios-for-android.html.
Thanks in advance for any help.· Determining the area of rectangle· Determining the area of triangle
Qbasic Program To Sort Numbers Worksheet
· Convert Celsius from Fahrenheit· Find out a year leap-year or not
· Determine an integer is even or odd
· Find the maximum minimum number between three numbers
· Find the grade letter on basis of mark
· Determine the total and the average of some numbers
· Find the GCD of two numbers
· Find the Factorial of an integer
· Test whether a number is prime or not
· Find sum of the numbers from 1 to 100
· Find sum of the odd numbers from 1 to 100
· Find sum of squared numbers from 1 to 100
· Sort n numbers
------------ --------- --------- --------- --------- --
Please type the code as following in QBASIC program for determining
the area and perimeter of a rectangle:
CLS
REM this program will determine the area and perimeter of a rectangle
INPUT 'Please enter the Length= ', 1
INPUT 'Please enter the width= ', w
P=2 * (1+w)
a=1 *w
PRINT 'The area of the rectangle is= '; a
PRINT 'The Perimeter of the rectangle is='; p
END
Please type the code as following in QBASIC program for determining
the area and perimeter of a rectangle:
CLS
REM this program will determine the area and perimeter of a rectangle
INPUT 'Please enter the Length= ', 1
INPUT 'Please enter the width= ', w
P=2 * (1+w)
a=1 *w
PRINT 'The area of the rectangle is= '; a
PRINT 'The Perimeter of the rectangle is='; p
END
Please type the code as following in QBASIC program for determining
the area of a triangle:
CLS
REM determine the area of a triangle
INPUT 'Please insert the length of 3 line (A, B, C) of triangle= ', a,
b, c
S= (a+b+c)/2
Area=SQR(s * (s-a) * (s-b) *(s-c))
PRINT 'The Area of the triangle is= '; area
END
Please Type the code as following in QBASIC program to convert Celsius
from Fahrenheit:
CLS
REM 'converting Celsius from Fahrenheit'
INPUT 'Fahrenheit= ', f
C=f/2.664864864864#
PRINT 'Celsius= '; c
END
Please Type the code as following in QBASIC program to find out a year
is leap year or not:
CLS
INPUT 'The year is= ' , y
IF (y MOD 4=0) THEN
PRINT 'This is a leap year'
ELSE
PRINT 'This is not a leap year'
END IF
END
Please Type the code as following in QBASIC program to find out a
number is even or odd:
CLS
REM 'Determine an integer is even or odd'
INPUT 'Enter the number here= ', n
IF n MOD 2=0 THEN
PRINT 'This number is Even'
ELSE
PRINT 'This number is Odd'
END IF
END
Please Type the code as following in QBASIC program to find the
Maximum and minimum number from three numbers:
CLS
INPUT 'Please input the 1st number= ', a
INPUT 'Please input the 2nd number= ', b
INPUT 'Please input the 3rd number= ', c
Max=a
IF b > max THEN max= b
IF c > max THEN max= c
PRINT 'The largest number is= '; max
Min= a
IF b < min THEN min = b
IF c < min THEN min = c
PRINT 'The Smallest number is = '; min
END
Please Type the code as following in QBASIC program to determine the
grade point basis on Subject mark:
CLS
REM 'Determining the grade point basis on Subject mark'
INPUT 'Enter the subject mark = ', n
IF n >= 80 AND n <= 100 THEN
PRINT 'The grade point = A+'
END IF
IF n >=70 AND n <=79 THEN
PRINT 'The grade point = A'
END IF
IF n >=60 AND n <=69 THEN
PRINT 'The grade point = A-'
END IF
IF n>=50 AND n <=59 THEN
PRINT 'The grade point = B'
END IF
IF n >=40 AND n <=49 THEN
PRINT 'The grade point = C'
END IF
IF n >=33 AND n<=39 THEN
PRINT 'The grade point = D'
END IF
IF n < 33 THEN
PRINT 'The grade point = F'
END IF
END
Please Type the code as following in QBASIC program for determining
the total & average for three numbers:
CLS
REM This program will determine average for 3 numbers
INPUT 'Please enter 1st number = ', a
INPUT 'Please enter 2nd number = ', b
INPUT 'Please enter 3rd number = ', c
t = a+b+c
s =T / 3
PRINT 'The Total is = '; t
PRINT 'The average is = ';s
END
Please Type the code as following in QBASIC program to find the GCD
code of two numbers:
CLS
INPUT 'Enter the Largest Number = ', L
INPUT 'Enter the Smallest Number = ', S
DO WHILE S <> 0
T = L MOD S
L = S
S = t
LOOP
PRINT 'The G.C.D code is = '; L
END
Please Type the code as following in QBASIC program to find the
factorial of an integer:
CLS
REM 'A program to find the Factorial of an integer'
INPUT 'The Factorial of which number: ', n
f = 1
For j = 1 To n
f = f * j
NEXT
PRINT 'The Factorial of'; n; 'is' = '; f
END
Please Type the code as following in QBASIC program to find the
factorial of an integer:
CLS
REM 'A program to find the Factorial of an integer'
INPUT 'The Factorial of which number: ', n
f = 1
For j = 1 To n
f = f * j
NEXT
PRINT 'The Factorial of'; n; 'is' = '; f
END
Please Type the code as following in QBASIC program to test whether a
number is prime or not:
CLS
REM 'A program to test whether is prime or not'
INPUT 'Enter a number to test = ', n
FOR i = 2 TO SQR (n)
R=n MOD i
IF r=0 THEN
PRINT n; 'Is not a prime number'
EXIT FOR
END IF
NEXT i
IF r <> 0 THEN
PRINT n; 'is a prime number'
END
Please Type the code as following is QBASIC program to find the sum of
the number from 1 to 100:
CLS
REM 'A program to find the sum of the number from 1 to 100
1+2+3…+100'
total = 0
FOR s = 1 to 100 STEP 1
Qbasic Program To Sort Numbers In Ascending Order
total = total + sNEXT s
PRINT 'Total is = '; total
END
Please Type the code as following is QBASIC program to find the sum of
the odd number from 1 to 100:
CLS
REM 'A program to find the sum of the odd number from 1 to 100.
1+2+3…+100'
total = 0
FOR s = 1 to 100 STEP 2
total = total + s
NEXT s
PRINT 'Total is = '; total
END
Please Type the code as following is QBASIC program to find the sum of
the squared number from 1 to 100:
CLS
REM 'A program to find the sum of squared number form 1 to 100'
INPUT 'Enter the value of n = ', n
total= 0
FOR s = 1 TO n STEP 1
Total = total + s ^ 2
NEXT s
PRINT 'Total is = '; total
END
Please Type the code as following is QBASIC program for sorting N numbers:
REM Program to sort some numbers
CLS
INPUT 'How many number enter you = ', N
FOR I = 1 to N
INPUT 'Enter the number: ', A (I)
NEXT I
FOR I = 1 to (N 1)
Qbasic Program To Sort Numbers Anchor Chart
FOR J = 1 to (N 1)IF A (J) > A (J + 1) THEN SWAP A (J), A (J + 1)
NEXT J
NEXT I
PRINT 'Sorted Data: '
FOR I=1 to N
PRINT A (I)