Program to print Square Number of Given Number.
CLS
INPUT "Enter any number : "; n
s = n ^ 2
PRINT "Square = "; s
END
INPUT "Enter any number : "; n
s = n ^ 2
PRINT "Square = "; s
END
Using SUB Procedure
DECLARE SUB square(n)
CLS
INPUT "Enter any number : "; n
CALL square(n)
END
SUB square (n)
s = n ^ 2
PRINT "Square = "; s
END SUB
CLS
INPUT "Enter any number : "; n
CALL square(n)
END
SUB square (n)
s = n ^ 2
PRINT "Square = "; s
END SUB
Using FUNCTION Procedure
DECLARE FUNCTION square(n)
CLS
INPUT "Enter any number : "; n
s = square(n)
END
FUNCTION square (n)
s = n ^ 2
PRINT "Square = "; s
END FUNCTION
CLS
INPUT "Enter any number : "; n
s = square(n)
END
FUNCTION square (n)
s = n ^ 2
PRINT "Square = "; s
END FUNCTION
Program to print Cube Number of Given Number.
CLS
INPUT "Enter any number : "; n
s = n ^ 3
PRINT "Cube = "; s
END
INPUT "Enter any number : "; n
s = n ^ 3
PRINT "Cube = "; s
END
Using SUB Procedure
DECLARE SUB cube(n)
CLS
INPUT "Enter any number : "; n
CALL cube(n)
END
SUB cube(n)
s = n ^ 3
PRINT "Cube = "; s
END SUB
CLS
INPUT "Enter any number : "; n
CALL cube(n)
END
SUB cube(n)
s = n ^ 3
PRINT "Cube = "; s
END SUB
Using FUNCTION Procedure
DECLARE FUNCTION cube(n)
CLS
INPUT "Enter any number : "; n
s = cube(n)
END
FUNCTION cube(n)
s = n ^ 3
PRINT "Cube = "; s
END FUNCTION
CLS
INPUT "Enter any number : "; n
s = cube(n)
END
FUNCTION cube(n)
s = n ^ 3
PRINT "Cube = "; s
END FUNCTION
No comments:
Post a Comment
If you have any doubts, Please let me know.