Skip to main content

Output of BASIC Programs (Computer Note IX Class)

Write down the output of the following BASIC Programs:

1. 10 READ J, K, L
20 FOR I = J TO K STEP L
30 PRINT I
40 NEXT I
50 DATA 2, 10, 3
60 END

2. 10 CLS
20 FOR I = 1 TO 10
30 PRINT I, “MY NAME”
40 NEXT I
50 END

3. 10 READ A, B, C
20 FOR I = A TO B STEP C
30 PRINT I
40 NEXT I
50 DATA 2, 10, 2
60 END

4. 10 CLS
20 INPUT U, V
30 LET W = U + V
40 LET Y = W * V
50 LET Z = Y/U
60 PRINT U, V
70 PRINT W, Y, Z
80 END

5. 10 CLS
20 LET R = -2
30 FOR T = 2 TO 15
40 LET R = R + 1
50 PRINT R
60 NEXT T
70 END

6. 10 A = 5: B = 13: C = 931
20 C = 5 * A Ù B + B Ù 2/2
30 PRINT C
40 END

7. 10 FOR I = 1 TO 100 STEP 10
20 PRINT I
30 IF I = 10 THEN I = 100
40 NEXT I
50 END

8. 10 CLS
20 N$ = “ABDUS-SAMAD”
30 N1$ = LEFT$ (N$, 1)
40 N2$ = MID$ (N$, 5, 1)
50 N3$ = MID$ (N$, 8, 1)
60 N4$ = RIGHT$ (N$, 1)
70 NN$ = N1$ + N2$ + N3$ + N4$
80 PRINT NN$
90 END

9. 10 X$ = “DATA – SOFT”
20 FOR I = 1 TO 9
30 Y$ = LEFT$ (X$, I)
40 PRINT Y$
50 NEXT I
60 END

10. 10 LET A = 11
20 WHILE A < 99
30 LET A = A + 11
40 PRINT A
50 WEND
60 END
11. 10 LET A = 0
20 LET B = 1
30 LET C = A + B
40 PRINT C
50 LET A = B
60 LET B = C
70 IF C < 21 THEN GOTO 30
80 END

12. 10 CLS
20 FOR I = 1 TO 10
30 FOR J = 1 TO I
40 PRINT I;
50 NEXT J
60 PRINT
70 NEXT I
80 END

13. 10 FOR A = 10 TO 0 STEP –2.5
20 PRINT A
30 LET S = S + A
40 NEXT A
50 ? S
60 END

14. 10 CLS
20 LET K = -1
30 FOR L = 1 TO 20
40 LET K = K + 2
50 PRINT K;
60 NEXT L
70 END

15. 10 ? “This is first line”
20 ? “It is second row”
30 ? “What is it?”
40 ? “Remember where it should be!”

16. 10 CLS
20 FOR I = 1 TO 8
30 PRINT X
40 PRINT I
50 NEXT I
60 END

17. 10 CLS
20 A = A + 1
30 B = A Ù 2
40 C = A Ù 3
50 D = A Ù 4
60 PRINT A, B, C, D
70 IF A = 6 THEN END ELSE GOTO 20

18. 10 LET K = -1
20 FOR I = 1 TO 20
30 LET K = K + I
40 PRINT K
50 NEXT I

19. 10 FOR I = 1 TO 10
20 PRINT I, “PAKISTAN ZINDABAD”
30 NEXT I
40 END

20. 10 FOR X = 0 TO 20 STEP 2
20 SUM = SUM + X
30 PRINT X, SUM
40 NEXT X

21. 10 FOR X = 6 TO 18 STEP 2
20 LET A = X- 4
30 IF A = 10 THEN 60
40 PRINT A, X
50 GOTO 70
60 PRINT “X=”;X
70 NEXT X
80 END

Comments

Popular posts from this blog

Chrysler Deletes Its Dating Apps, Decides To Remain Single For Now

They say you can’t have a healthy relationship until you’re happy with yourself. That appears to be the new mantra for Fiat Chrysler: After several attempts to woo General Motors and more recently Volkswagen , the carmaker’s top executive says he plans to ditch his lovelorn ways to concentrate on his company’s bottom line.  Bloomberg reports that CEO Sergio Marchionne has turned his focus to eliminating FCA’s debt rather than eliminating its single status. Marchionne has set a goal of erasing FCA’s debt by 2019, the same year he’s set to retire. To do that, he says the company needs to do a little work on itself. “We need to be very careful that we don’t start unrealistic dreams about consolidation as we are on our way to achieve historically important results and a debt-free position,” Marchionne told investors at the carmaker’s annual meeting in Amsterdam, as reported by Bloomberg. “We are not at a point of time to discuss any alliance.” Yes, you heard that right: The man w...

Study Claims 43% Of “Wild” Salmon In Stores & Restaurants Isn’t Wild At All

That wild salmon entrée calling to you from the menu at dinner might not be all it’s advertised. In fact a new study released Wednesday found evidence of mislabeling in nearly half of all salmon sold in restaurants and grocery stores.  The study [ PDF ] from international environmental advocacy group, Oceana, analyzed 82 salmon samples from restaurants and grocery stores, finding that 43% of the products were mislabeled. DNA testing confirmed that 69% of the mislabeled product consisted of farmed Atlantic salmon being sold as wild-caught product. According to the report, consumers satisfying their salmon craving in restaurants are misled about 67% of the time, while those who buy their seafood in a grocery store are misled 20% of the time. “Americans might love salmon, but as our study reveals, they may be falling victim to a bait and switch,” Beth Lowell, senior campaign director at Oceana, said . “When consumers opt for wild-caught U.S. salmon, they don’t expect to get a far...

Introduction to Biology (IX Biology Notes Chapter 01)

Science: Our universe operates under certain principles. For understanding of these principles, the experiments are done and observations are made; on the basis of which logical conclusions are drawn. Such a study is called "Science". In brief science is the knowledge based on experiments and observations. Biology: The Scientific study of living organisms is called Biology. The word biology is derived from two Greek words "bios" meaning life and "logos" meaning thought, discourse, reasoning or study. It means that all aspects of life and every type of living organism are discussed in biology. Branches of Biology: Biology is divided into following branches: Morphology The study of form and structure of living organisms is called morphology. It can be further divided into following two parts: 1. The study of external parts of living organism is called external morphology. 2. The study of internal parts of living organism is calle...