· Determining the area of rectangle
· Determining the area of triangle
· 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
PRINT "The area of the rectangle is= "; a
PRINT
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
PRINT "The area of the rectangle is= "; a
PRINT
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
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
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
PRINT "The grade point = A+"
END IF
IF n >=70 AND n <=79 THEN
PRINT
PRINT "The grade point = A"
END IF
IF n >=60 AND n <=69 THEN
PRINT
PRINT "The grade point = A-"
END IF
IF n>=50 AND n <=59 THEN
PRINT
PRINT "The grade point = B"
END IF
IF n >=40 AND n <=49 THEN
PRINT
PRINT "The grade point = C"
END IF
IF n >=33 AND n<=39 THEN
PRINT
PRINT "The grade point = D"
END IF
IF n < 33 THEN
PRINT
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
PRINT "The Total is = "; t
PRINT
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
PRINT
INPUT "Enter the Smallest Number = ", S
DO WHILE S <> 0
T = L MOD S
L = S
S = t
LOOP
PRINT
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
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
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
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
total = total + s
NEXT s
PRINT
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
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
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)
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)
NEXT I
END
Saturday, July 21, 2007
Subscribe to:
Post Comments (Atom)
10 comments:
u re really awesome kudos and keep it up
Wow! This is really helpful. THANKS
Can u tell me how to count the no. of odd and even numbers from 1 to 10???
Can u tell me how to count the no. of odd and even numbers from 1 to 10???
can u write the program which prints his/her name in short form?
How to write a modular program using SUB and FUNCTION to find the total number of constants in a string?
To print the series of 3,33,333,3333,33333 please do fast
Please give examples of loops
Can any solve this .wr write a program
That decimal no.convert into octal representation.
WAP to extract 'FEB' from 'FEBRUARY. Csn you solve this
Post a Comment