New Questions Answers of SUB...END SUB

1.Write a program to define a sub procedure Sum(a,b) to display sum of any two numbers input by a user.

DECLARE SUB Sum(a,b)
CLS
INPUT "ENTER A FIRST NUMBER";a
INPUT "ENTER A SECOND NUMBER";b
CALL Sum(a,b)
END


SUB Sum(a,b)
s=a+b
PRINT "SUM=";s
END SUB


2. Write a program to display area of a rectangle by using SUB...END SUB. This program allows a user to input required data in the main module.

DECLARE SUB areaRectangle(l,b)
CLS
INPUT "ENTER A LENGTH ";l
INPUT "ENTER A BREADTH";b
CALL areaRectangle(l,b)
END 


SUB areaRectangle(l,b)
area=l*b
PRINT "AREA IS ";area
END SUB

Comments

Blog27999 said…
As reported by Stanford Medical, It's really the SINGLE reason women in this country get to live 10 years longer and weigh an average of 19 KG less than us.

(And actually, it has NOTHING to do with genetics or some hard exercise and absolutely EVERYTHING related to "HOW" they eat.)

P.S, What I said is "HOW", and not "what"...

Tap on this link to uncover if this easy quiz can help you find out your true weight loss potential
Unknown said…
Wap to check whether a given number is perfect cube or not by using sub end sub procedures

Popular posts from this blog

PROGRAM TO FIND SQUARE, CUBE, SQUARE ROOT AND CUBE ROOT OF GIVEN NUMBER

PROGRAM TO DISPLAY SUM, PRODUCT, DIFFERENCE AND PRODUCT OF TWO / THREE NUMBERS

PALINDROME AND ARMSTRONG PROGRAMS