[go: up one dir, main page]

0% found this document useful (0 votes)
543 views5 pages

GW Basic Program 3

The document provides examples of BASIC programs to perform arithmetic operations, calculate areas of shapes, find average of numbers and percentage. It also shows programs using input, if-then and for-next statements to take user input, compare values and loop through a range of numbers.

Uploaded by

m.zunairfaisal1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
543 views5 pages

GW Basic Program 3

The document provides examples of BASIC programs to perform arithmetic operations, calculate areas of shapes, find average of numbers and percentage. It also shows programs using input, if-then and for-next statements to take user input, compare values and loop through a range of numbers.

Uploaded by

m.zunairfaisal1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Direct Mode

‫ںیمدوربمنعمجرکےنےکےیلاکیرپورگامںیھکل۔‬BASIC.
31. Write a Program to add two numbers in BASIC.

N1 =50
ok
N2 =50
ok
Sum = N1+ N2
ok
PRINT SUM
100
ok

Write a Program to Subtraction two numbers in BASIC


N1 =100
ok
N2 =50
ok
SUB = N1-N2
ok
PRINT SUB
50
ok

Write a Program to Multiplication two numbers in BASIC


1 N1 =50
ok
N2 =50
ok
MULT = N1*N2
ok
PRINT MULT
2500
Ok

Write a Program to Division two numbers in BASIC


N1 =50
ok
N2 =2
ok
DIV = N1/ N2
ok
PRINT DIV
25
ok
Indirect Mode
31. Write a Program to add two numbers in BASIC.
10 CLS
20 N1 =50
30 N2 =50
40 Sum = N1+ N2
50 PRINT “SUM”; SUM
60 END
RUN or press F2
100

Write a Program to Subtraction two numbers in BASIC


10 CLS
20 N1 =100
30 N2 =50
40 SUB = N1+ N2
50 PRINT “SUB”; SUB
60 END
RUN or press F2
50

Write a Program to Multiplication two numbers in BASIC


10 CLS
20 N1 =50
30 N2 =50
40 MULT = N1+ N2
50 PRINT “MULT”; MULT
60 END
RUN or press F2
2500

Write a Program to Division two numbers in BASIC


10 CLS
20 N1 =100
30 N2 =2
40 DIV = N1/N2
50 PRINT “DIV”; DIV
60 END
RUN or press F2
25
‫اکیااسیرپورگامںیھکلوجدارئےےکرےبقوکولعممرکےکس۔‬
Write a program that can calculate the area of a circle.
10 CLS 20 INPUT” enter radius.”, R
30 AREA = 3.14*R*R
40 PRINT “AREA = “, AREA
50 END
RUN OR PRESS F2
‫اکیااسیرپورگامںیھکلوجیطتسمےکرےبقوکولعممرکےکس۔‬
35. Write a program that can calculate the area of a rectangle
10 CLS 20 INPUT” Length..”, L
30 INPUT” width.”, W
40 AREA = L*W
50 PRINT “AREA = “, AREA
60 END

Input statement

‫ںیمدوربمنعمجرکےنےکےیلاکیرپورگامںیھکل۔‬BASIC.
31. Write a Program to add two numbers in BASIC.
10 CLS
20 INPUT “FIRST Number – “, N1
30 INPUT “Second Number – “, N2
40 Sum = N1+ N2
50 PRINT “SUM”; SUM
60 END RUN or press F2

Write a Program to Subtraction two numbers in BASIC


10 CLS
20 INPUT “FIRST Number – “, N1
30 INPUT “Second Number – “, N2
40 SUB = N1-N2
50 PRINT “Subtraction”; SUB
60 END RUN or press F2

Write a Program to Multiplication two numbers in BASIC


10 CLS
20 INPUT “FIRST Number – “, N1
30 INPUT “Second Number – “, N2
40 MULT = N1*N2
50 PRINT “Multiplication”; MULT
60 END RUN or press F2
Write a Program to Division two numbers in BASIC
10 CLS
20 INPUT “FIRST Number – “, N1
30 INPUT “Second Number – “, N2
40 DIV= N1*N2
50 PRINT “Division”; DIV
60 END RUN or press F2
‫ااسیرپورگامںیھکلوجاچرربمنڑپھرکانیکاوطسرپٹنرکےکس۔‬
32. Write such program which can read four numbers and print their average.
10 CLS 20 INPUT “first Number “, N1
30 INPUT “Second Number “, N2
40 INPUT “third Number “, N3
50 INPUT “fourth Number “, N4
60 SUM = N1+ N2+N3+N4
70 AVG = SUM / 4
80 PRINT “SUM”; SUM
90 PRINTS” AVERAGE =”; AVG
100 END
RUN or press F2

write a program in basic find percentage


10 input total marks
20 input obtained marks
30 Percentage =( obtained marks/ total marks)*100
40 print percentage
50 end

If-Then Statement
Write a program which can find the largest number of given three number
‫ے‬
‫دیےئگنیتربمنوںںیمےسبسےسباربمنالتشرکےکس۔‬‫اکیرپورگامںیھکلوج ئ‬
10 CLS 20 INPUT “enter first Number “, A
30 INPUT “enter second Number “, B
40 INPUT “enter third Number “, C
50 IF A>B AND A> C THEN PRINT” largest number is:”; A: END
60 IF B >A AND B > C THEN PRINT” largest number is:”;B:END
70 IF C >B AND C > A THEN PRINT” largest number is:”; C: END
80 END
‫کتتفجدعد رپٹنرکےنےکےیلاکیرپورگامںیھکل۔‬40‫ےس‬2
Write a Program to Print even numbers from 2 to 40
Program:
10 CLS
20 FOR B = 2 TO 40 STEP 2
30 PRINT B
40 NEXT B
50 END

You might also like