QBasic DIM pass(4) CLS RANDOMIZE TIMER pass(1) = 5: pass(2) = 5: pass(3) = 10: pass(4) = 10 i=1 gess = 0 WHILE i <= 4 a = 10 ^ (i - 1): b = 10 ^ i adad = INT(RND * (b - a) + a) j=1 found = 0 WHILE (j <= pass(i)) AND found = 0 PRINT " pass = "; i, "number's is= "; j, "number repeat gess is ="; gess PRINT "k="; adad INPUT "Enter your guse?", n IF n < adad THEN PRINT "Is < " IF n > adad THEN PRINT "Is >" IF n = adad THEN PRINT "OK " found = 1 END IF j=j+1 WEND IF found = 1 THEN gess = gess + 1 CLS PRINT "gess is ", gess ELSE gess = 0 PRINT " I am Sorry for you " PRINT "this pass is agian" END IF IF gess = 3 THEN i=i+1 gess = 0 PRINT " Afarin you passed passing "; i END IF WEND PRINT " Afarin " END
QBasic
OPTION BASE 1 CLS DIM n AS INTEGER DO INPUT "Enter number of Row or colmun Matrix n>=1 ? ", n LOOP WHILE n <= 1 DIM M(n, n) AS SINGLE CLS PRINT " Enter numbers for Array " FOR i = 1 TO n FOR j = 1 TO n LOCATE i + 1, j * 5 INPUT "", M(i, j) NEXT j, i CLS PRINT " Matrix is " FOR i = 1 TO n FOR j = 1 TO n PRINT M(i, j), NEXT j PRINT NEXT i flagLow = 1: flagUp = 1 FOR i = 1 TO n FOR j = 1 TO n IF i < j AND M(i, j) <> 0 THEN flagLow = 0 IF i > j AND M(i, j) <> 0 THEN flagUp = 0 NEXT j, i IF flagLow = 1 THEN PRINT "Marix is Lower triangular " IF flagUp = 1 THEN PRINT "Marix is Upper triangular " IF flagLow = 0 AND flagUp = 0 THEN PRINT "Marix is NO Lower or Upper triangular " END