Tuesday 31 December 2019

Computer Studies For Class IX (Science) and X (Arts /General /Humanities Group) - Practical No.3

Go To Index

Practical No. 3: W.A.P. to calculate the SQUARE and CUBE of first ten natural numbers.


10  CLS
20  PRINT “NUMBERS”, “SQUARE”, “CUBE”
30  PRINT “~~~~~~~~~”, “~~~~~~~~”, “~~~~”
40  FOR N = 1 TO 10
50  PRINT   N, N^2, N^3
60  NEXT  N
70  PRINT  STRING$(35, “~”)
80  END
RUN


OR

10 REM CALCULATE SQUARE AND CUBE OF FIRST TEN NATURAL NUMBERS
20 CLS
30 PRINT TAB(5) "NUMBERS", "SQUARES", "CUBE"
40 FOR N = 1 TO 10
50 LET S = N^2
60 LET C = N^3
70 PRINT TAB(5) N, S, C
80 NEXT N
90 END



OUTPUT

NUMBERS  SQUARES  CUBE
1        1         1
2        4         8
3        9         27
4        16        64
5        25        125
6        36        216
7        49        343
8        64        512
9        81        729
10       100       1000

No comments:

Post a Comment