Skip to main content

SEE-qbasic function Procedure | numeric patterns | important question |

Qbasic Programs

function procedure


A.Write a program (WAP) using FUNCTION Procedure statement:

C. Wap a qbasic program in string patterns 👈 click
                 Download qbasic in android
B.  Wap in QBASIC to display the following numeric series using FUNCTION statement.

i).1, 8, 27,......upto 10th term

Declare function n(i)
Cls
For i=1 to 10
Print n(i);
Next i
End
Function n(i)
n=i^3
End function

ii) 2 1 3 4 7 11 ...upto 11th term

Declare function s(a,b,c)
Cls
A=2
B=1
For i=1 to 11
Print s(a,b,c);
Next i
End
Function s(a,b,c)
S=A
C=A+B
A=B
B=C
END FUNCTION

iii). 50, 45, 35,....0

declare function r(a,b)
cls
a=50
b=5
While a>=0
Print r(a,b);
Wend
End
Function r(a,b)
r=a
a=a-b
b=b+5
end function

4).
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

Declare function n(i)
Cls
For i=1 to 5
For j=1 to i
Print n(i);
Next j
Print
Next i
End
Function n(i)
N=i
End function

5).
9 7 5 3 1
9 7 5 3
9 7 5
9 7
9

Declare function n(i)               
Cls
A=1
zz:
For i=9 to a step -2
PRINT N(i);
Next i
A=a+2
Print
If a<=9 then goto zz
End
Function n(i)
n=i
End function

OR

DECLARE FUNCTION A(J)
CLS
FOR I=1 TO 9 STEP 2
FOR J=9 TO I STEP -2
PRINT A(J);
NEXT J
PRINT
NEXT I
END

FUNCTION A(J)
A=J
END FUNCTION


6) 1  12  123  1234   12345

DECLARE FUNCTION SERIES(A.B)
CLS
LET A=1
LET B=2
X=SERIES(A,B)
END
FUNCTION SERIES(A,B)
FOR =1 TO 5
PRINT A;
A=A*10+B
B=B+1
NEXT I
END FUNCTION

7)
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1

DECLARE FUNCTION A(I,J)
CLS
FOR I = 5 TO 1 STEP -1
FOR J= 1 TO 5
PRINT A(I,J);
NEXT J
PRINT
NEXT I
END
FUNCTION A(I,J)
A=I
END FUNCTION

MANY STUDENTS CONFUSE IN

*)
55555
4444         [HERE THERE IS NO SPACE 
333             IN NO.  BUT UP THERE IS    
22                 SPACE]
1

DECLARE FUNCTION A(N,I)
CLS
N = 11111
I = 5
WHILE N<>0
 PRINT A(N,I);
   N=N\10
    I=I-1
  WEND
END
FUNCTION A(N,I)
A=N*I
END FUNCTION







Comments

Post a Comment

Popular posts from this blog

SEE-Qbasic function procedure | all qbasic program | function procedure

SEE Qbasic programs Function Procedure Download qbasic in android 1.Wap a program to convert nepali currency to American Currency where 1$ =Rs 95 DECLARE FUNCTION am(nc) CLS input "nepali currency=";nc print "American currency=";am(nc) end function am(NC) am=NC/95 end function 2. Wap to declare a user-defined function to reverse a string . DECLARE FUNCTION  a$(n$) cls input "enter any word";n$ print "reverse of string"a$(n$) end function a$(n$) for i=len(n$) to 1 step -1 b$=b$+mid$(n$,i,1) next i a$=b$ end function 3. Wap to calculate simple interest in given principle ,time,rate. DECLARE FUNCTION si(p,t,r) cls input "enter principle,time,rate=";p,t,r print "simple interest=";si(p,t,r) end function si(p,t,r) si=(p*t*r)/100 end function 4. Wap to create a function area(l,b,h) to calculate and print total surface area(tsa) of box DECLARE FUNCTION area(l,b,h) cls INPU...

SEE-FUNCTION PROCEDURE STRING PATTERNS

QBASIC PROGRAMS STRING PATTERNS FUNCTION.....END FUNCTION Download qbasic in android A .Write a program (WAP) using FUNCTION Procedure statement:  👈 click B.  Numeric patterns in function procedure:click 👈 C.  WAP to make a string patterns: A.  *SCIENCE*  *CIENC*    *IEN*       *E* DECLARE FUNCTION a$(n$,I,B) CLS B=1 n$="SCIENCE" FOR I=LEN(N$) TO 1 STEP -2 PRINT TAB(B);"*";A$(N$,I,B);"*" B=B+1 NEXT I FUNCTION A$(N$,I,B) A$=MID$(N$,B,I) END FUNCTION B. C COM COMPU COMPUTE COMPUTERS DECLARE FUNCTION A$(N$,I) CLS N$="COMPUTERS" FOR I=1 TO LEN(N$) STEP 2 PRINT A$(N$,I) NEXT I END FUNCTION A$(N$,I) A$=LEFT$(N$,I) END FUNTION