DIVISIBLE, PRDUCT AND SUM OF 10 NUMBERS



146. WAP to enter any 15 numbers and display only those numbers which are divisible by 5.

CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "THE NUMBERS WHICH ARE DIVISIBLE BY 5 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 THEN PRINT N(I)
NEXT I
END

USING SUB PROCEDURE
DECLARE SUB DIVISIBLE (N( ))
CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL DIVISIBLE (N ( ))
END

SUB DIVISIBLE (N ( ))
PRINT "THE NUMBERS WHICH ARE DIVISIBLE BY 5 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 THEN PRINT N(I)
NEXT I
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION DIVISIBLE (N( ))
CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
D = DIVISIBLE(N())
END

FUNCTION DIVISIBLE (N())
PRINT "THE NUMBERS DIVISIBLE BY 5 ARE";
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 THEN PRINT N(I)
NEXT I

END FUNCTION

147.   WAP to enter any 15 numbers and display only those numbers which are divisible by 5 and 7.

CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "THE NUMBERS WHICH ARE DIVISIBLE BY 5 AND 7 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 AND N(I) MOD 7 = 0 THEN PRINT N(I)
NEXT I
END

USING SUB PROCEDURE
DECLARE SUB DIVISIBLE (N( ))
CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL DIVISIBLE (N ( ))
END

SUB DIVISIBLE (N ( ))
PRINT "THE NUMBERS WHICH ARE DIVISIBLE BY 5 AND 7 ARE"
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 AND N(I) MOD 7 = 0 THEN PRINT N(I)
NEXT I
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION DIVISIBLE (N( ))
CLS
DIM N(15)
FOR I = 1 TO 15
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
D = DIVISIBLE(N( ))
END

FUNCTION DIVISIBLE (N( ))
PRINT "THE NUMBERS DIVISIBLE BY 5 AND 7 ARE";
FOR I = 1 TO 15
IF N(I) MOD 5 = 0 AND N(I) MOD 7 = 0 THEN PRINT N(I)
NEXT I

END FUNCTION

148. WAP to enter any 5 numbers and display its product.
CLS
P = 1
FOR I = 1 TO 5
INPUT "ENTER THE NUMBERS"; N(I)
P = P * N(I)
NEXT I
PRINT "PRODUCT OF 5 NUMBERS"; P
END


USING SUB PROCEDURE
DECLARE SUB PRODUCT (N( ))
CLS
FOR I = 1 TO 5
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL PRODUCT (N( ))
END


SUB PRODUCT (N())
P = 1
FOR I = 1 TO 5
P = P * N(I)
NEXT I
PRINT "PRODUCT OF 5 NUMBERS"; P
END SUB




USING FUNCTION PROCEDURE
DECLARE FUNCTION PRODUCT (N( ))
CLS
FOR I = 1 TO 5
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "PRODUCT OF 5 NUMBERS"; PRODUCT (N( ))
END


FUNCTION PRODUCT (N())
FOR I = 1 TO 5
P = P * N(I)
NEXT I
PRODUCT = P
END FUNCTION

149.  WAP to enter any 10 numbers and find the sum of numbers.

CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
S = S + N(I)
NEXT I
PRINT "SUM OF 10 NUMBERS"; S
END

USING SUB PROCEDURE
DECLARE SUB SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL SUM(N( ))
END

SUB SUM (N())
FOR I = 1 TO 10
S = S + N(I)
NEXT I
PRINT "SUM OF 10 NUMBERS"; S
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "SUM OF 10 NUMBERS"; SUM(N( ))
END


FUNCTION SUM (N())
FOR I = 1 TO 10
S = S + N(I)
NEXT I
SUM = S
END FUNCTION

150.   WAP to enter any 10 numbers and find the sum of odd numbers.

CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
IF N(I) MOD 2 = 1 THEN S = S + N(I)
NEXT I
PRINT "SUM OF 10 ODD NUMBERS"; S
END

USING SUB PROCEDURE
DECLARE SUB SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL SUM(N( ))
END

SUB SUM (N())
FOR I = 1 TO 10
IF N(I) MOD 2 = 1 THEN S = S + N(I)
NEXT I
PRINT "SUM OF 10 ODD NUMBERS"; S
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "SUM OF 10 ODD NUMBERS"; SUM(N( ))
END


FUNCTION SUM (N())
FOR I = 1 TO 10
IF N(I) MOD 2 = 1 THEN S = S + N(I)
NEXT I
SUM = S
END FUNCTION

151. WAP to enter any 10 numbers and find the sum of even numbers.
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
IF N(I) MOD 2 = 0 THEN S = S + N(I)
NEXT I
PRINT "SUM OF 10 EVENNUMBERS"; S
END

USING SUB PROCEDURE
DECLARE SUB SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
CALL SUM(N( ))
END

SUB SUM (N())
FOR I = 1 TO 10
IF N(I) MOD 2 = 0 THEN S = S + N(I)
NEXT I
PRINT "SUM OF 10 EVENNUMBERS"; S
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION SUM (N( ))
CLS
FOR I = 1 TO 10
INPUT "ENTER THE NUMBERS"; N(I)
NEXT I
PRINT "SUM OF 10 EVEN NUMBERS"; SUM(N( ))
END


FUNCTION SUM (N())
FOR I = 1 TO 10
IF N(I) MOD 2 = 0 THEN S = S + N(I)
NEXT I
SUM = S
END FUNCTION

Comments

Unknown said…
Thanku for the help!!!
Unknown said…
pls solve this
to print sum and product of first 10 natural mumbers
i need this sum pls reply
Unknown said…
pls solve this
to print sum and product of first 10 natural mumbers
i need this sum pls reply
Unknown said…
You should see how my buddy Wesley Virgin's autobiography launches in this SHOCKING AND CONTROVERSIAL video.

As a matter of fact, Wesley was in the army-and shortly after leaving-he revealed hidden, "SELF MIND CONTROL" secrets that the CIA and others used to get whatever they want.

THESE are the exact same SECRETS many famous people (notably those who "became famous out of nowhere") and elite business people used to become rich and successful.

You probably know how you use less than 10% of your brain.

That's mostly because most of your brainpower is UNCONSCIOUS.

Perhaps that conversation has even occurred IN YOUR own head... as it did in my good friend Wesley Virgin's head about 7 years ago, while riding an unlicensed, beat-up bucket of a car without a driver's license and $3.20 on his bank card.

"I'm so fed up with going through life check to check! Why can't I turn myself successful?"

You've been a part of those those types of questions, ain't it right?

Your success story is going to start. Go and take a leap of faith in YOURSELF.

Watch Wesley Virgin's Video Now!

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