Thursday, July 28, 2011

Qbasic (Find Area of Four Walls)

DECLARE FUNCTION AR(N, A, M)
INput "Enter the height"; h
Input "Enter the length"; l
Input "Enter the breadth"; b
Area = Ar(N, A, M)
Print "Area of fout walls"; Area
End

Function Ar(N,A, M)
Ar = 2*h*(l+b)
End Function

Qbasic (Find the Volume of a Circle)

Declare Function Vol(N,A)
CLS
INPUT "Enter a radius"; R
Input "Enter the height"; h
Volume = Vol (N,A)
Print "The Volume is"; Volume
END

Function VOL(N,A)
Const PI = 3.1416
Vol = Pi * R^2 *h
END FUNCTION

Wednesday, July 27, 2011

Qbasic (Find whether the given no. is palindrome)

Declare Function Palin(N)
Cls
Input "A No."; N
Pal = palin(N)
If pal = n then
Print "Numeric Palindrome"
Else
Print "Not Palindrome"
End If
End

Function Palin(N)
M=N
While M<>0
K = M mod 10
P = P*10+R
M = M\10
WEND
Palin = P
END FUNCTION

Qbasic (Find the Current Month)

Declare Function curmth$(n$())
CLS
DIM n$(12)
For J = 1 to 12
READ N$(J)
NEXT
M$ = Curmth$(N$())
Print "Current system month is "; M$
Data Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sept, Oct, Nov, Dec
End

Function Curmth$(N$())
D$ = Date$
N = Val (Left$(D$,2)
For M = 1 to 12
If N=K then
Z$ = N$(K)
ENDIF
NEXT
CURMTH$ = Z$
END FUNCTION