CHECK DIVISIBLE, ODD EVEN, POSITIVE, NEGATIVE, ZERO, VOTE OR NOT, DRIVE OR NOT, PASS OR FAIL

81. WAP to input any number and check whether the given no. is divisible by 5 or not.

REM
CLS
INPUT “ENTER ANY NUMBER”; N
IF N MOD 5 = 0 THEN
PRINT N; IS DIVISIBLE BY 5”
ELSE
PRINT N; IS NOT DIVISIBLE BY 5”
END IF
END
USING SUB PROCEDURE
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
SUB CHECK (N)
IF N MOD 5 = 0 THEN
PRINT N; IS DIVISIBLE BY 5”
ELSE
PRINT N; IS NOT DIVISIBLE BY 5”
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N) ; “BY 5”
END
FUNCTION CHECK$ (N)
IF N MOD 5 = 0 THEN
CHECK$ = “DIVISIBLE”
ELSE
CHECK$ = “NOT DIVISIBLE”
END IF : END FUNCTION
82.   WAP to input any number and check whether the given no. is divisible by 3 and 7 or not.
REM
CLS
INPUT “ENTER ANY NUMBER”; N
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
PRINT N; IS COMPLETELY DIVISIBLE BY 3 AND 7”
ELSE
PRINT N; IS NOT COMPLETELY DIVISIBLE BY 3 AND 7”
END IF
END
USING SUB PROCEDURE
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
SUB CHECK (N)
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
PRINT N; IS COMPLETELY DIVISIBLE BY 3 AND 7”
ELSE
PRINT N; IS NOT COMPLETELY DIVISIBLE BY 3 AND 7”
END IF
END SUB
USING FUNCTION PROCEDURE

DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N) ; “BY 3 AND 7”
END
FUNCTION CHECK$ (N)
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
CHECK$ = “DIVISIBLE”
ELSE
CHECK$ = “NOT DIVISIBLE”
END IF
END FUNCTION
83.   WAP to input any number and check whether the given no. is positive, negative or zero.
REM
CLS
INPUT “ENTER ANY NUMBER”; N
IF N > 0 THEN
PRINT N; IS POSITIVE NUMBER”
ELSEIF N < 0 THEN
PRINT N; IS NEGATIVE NUMBER”
ELSE
PRINT N; IS ZERO”
END IF
END
USING SUB PROCEDURE
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
SUB CHECK (N)
IF N > 0 THEN
PRINT N; IS POSITIVE NUMBER”
ELSEIF N < 0 THEN
PRINT N; IS NEGATIVE NUMBER”
ELSE
PRINT N; IS ZERO”
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N)
END

FUNCTION CHECK$ (N)
IF N > 0 THEN
CHECK$ = “POSITIVE NUMBER”
ELSEIF N < 0 THEN
CHECK$ = “NEGATIVE NUMBER”
ELSE
CHECK$ = “ZERO”
END IF
END FUNCTION
84.   WAP to input a year and display whether that year is a leap year or not. [divisible by 4 but not 100]
REM
CLS
INPUT “ENTER YEAR”; Y
IF Y MOD 4 = 0 AND Y MOD 100 <> 0 OR Y MOD 400 = 0 THEN
PRINT Y; IS LEAP YEAR”
ELSE
PRINT Y; IS NOT LEAP YEAR”
END IF
END
USING SUB PROCEDURE

DECLARE SUB CHECK (Y)
CLS
INPUT “ENTER YEAR”; Y
CALL CHECK (Y)
END
SUB CHECK (Y)
IF Y MOD 4 = 0 AND Y MOD 100 <> 0 OR Y MOD 400 = 0 THEN
PRINT Y; IS LEAP YEAR”
ELSE
PRINT Y; IS NOT LEAP YEAR”
END IF
END SUB

DECLARE FUNCTION CHECK$ (Y)
CLS
INPUT “ENTER YEAR”; Y
PRINT Y; CHECK$(Y)
END

FUNCTION CHECK$ (Y)
IF Y MOD 4 = 0 AND Y MOD 100 <> 0 OR Y MOD 400 = 0 THEN
CHECK$ = “IS LEAP YEAR”
ELSE
CHECK$ = “IS NOT LEAP YEAR”
END IF
END FUNCTION

85.   WAP to input any number and display whether it is odd or even.
      REM
      CLS
      INPUT “ENTER ANY NUMBER”; N
      IF N MOD 2 = 0 THEN
      PRINT N; “IS EVEN NUMBER”
ELSE
PRINT N; “IS ODD NUMBER”
END IF
END

DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END

SUB CHECK (N)
IF N MOD 2 = 0 THEN
      PRINT N; “IS EVEN NUMBER”
ELSE
PRINT N; “IS ODD NUMBER”
END IF
END SUB

DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N)
END

FUNCTION CHECK$ (N)
IF N MOD 2 = 0 THEN
CHECK$ = “EVEN NUMBER”
ELSE
CHECK$ = “ODD NUMBER”
END IF
END

86. To divide a number by another number and find the quotient and remainder.

REM
CLS
INPUT "ENTER FIRST NUMBER"; A
INPUT "ENTER SECOND NUMBER"; B
IF A > B THEN
R = A MOD B
Q = A \ B
ELSE
R = B MOD A
Q = B \ A
END IF
PRINT "QUOTIENT="; Q
PRINT "REMAINDER ="; R
END
USING SUB PROCEDURE

DECLARE SUB DIVIDE (A, B)
CLS
INPUT "ENTER FIRST NUMBER"; A
INPUT "ENTER SECOND NUMBER"; B
CALL DIVIDE (A, B)
END

SUB DIVIDE (A, B)
IF A > B THEN
R = A MOD B
Q = A \ B
ELSE
R = B MOD A
Q = B \ A
END IF
PRINT "QUOTIENT="; Q
PRINT "REMAINDER ="; R
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION DIVIDE (A, B)
CLS
INPUT "ENTER FIRST NUMBER"; A
INPUT "ENTER SECOND NUMBER"; B
PRINT “REMAINDER=”; DIVIDE (A, B)
END
FUNCTION DIVIDE (A, B)
IF A > B THEN
R = A MOD B
Q = A \ B
ELSE
R = B MOD A
Q = B \ A
END IF
PRINT "QUOTIENT="; Q
DIVIDE = R
END FUNCTION

87.   WAP to input any number and check whether the given no. is positive or negative.

REM
CLS
INPUT “ENTER ANY NUMBER”; N
IF N > 0 THEN
PRINT N; IS POSITIVE NUMBER”
ELSEIF N < 0 THEN
PRINT N; IS NEGATIVE NUMBER”
END IF
END

USING SUB PROCEDURE

DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END

SUB CHECK (N)
IF N > 0 THEN
PRINT N; IS POSITIVE NUMBER”
ELSEIF N < 0 THEN
PRINT N; IS NEGATIVE NUMBER”
END IF
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N)
END

FUNCTION CHECK$ (N)
IF N > 0 THEN
CHECK$ = “POSITIVE NUMBER”
ELSEIF N < 0 THEN
CHECK$ = “NEGATIVE NUMBER”
END IF
END FUNCTION
88. Input a mark in a subject of a student and check if the student is pass or nor. [Pass Mark >=40]

REM
CLS
INPUT “ENTER MARKS”; M
IF M >= 40 THEN
PRINT “YOU ARE PASS”
ELSE
PRINT “ YOU ARE FAIL”
END IF
END

USING SUB PROCEDURE

DECLARE SUB CHECK (M)
CLS
INPUT “ENTER MARKS”; M
CALL CHECK (M)
END

SUB CHECK (N)
IF M >= 40 THEN
PRINT “YOU ARE PASS”
ELSE
PRINT “ YOU ARE FAIL”
END IF
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION CHECK$ (M)
CLS
INPUT “ENTER MARKS”; M
PRINT “YOU ARE “;CHECK$(M)
END

FUNCTION CHECK$ (M)
IF M >= 40 THEN
CHECK$ =“PASS”
ELSE
CHECK$ = “FAIL”
END IF
END FUNCTION

89. Input the age of a person and find out whether the person is eligible to drive or not. [age >=16]

REM
CLS
INPUT “ENTER YOUR AGE”; A
IF A >= 16 THEN
PRINT “YOU ARE ELIGIBLE TO DRIVE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO DRIVE”
END IF
END
USING SUB PROCEDURE

DECLARE SUB CHECK (A)
CLS
INPUT “ENTER YOUR AGE”; A
CALL CHECK (A)
END

SUB CHECK (A)
IF A >= 16 THEN
PRINT “YOU ARE ELIGIBLE TO DRIVE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO DRIVE”
END IF
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION CHECK$ (A)
CLS
INPUT “ENTER YOUR AGE”; A
PRINT “YOU ARE “;CHECK$(A)
END

FUNCTION CHECK$ (A)
IF A >= 16 THEN
CHECK$ = “ELIGIBLE TO DRIVE”
ELSE
CHECK$ = “ NOT ELIGIBLE TO DRIVE”
END IF
END FUNCTION
90. Input the age of a person and find out whether the person is eligible to vote or not. [age >=18]
REM
CLS
INPUT “ENTER YOUR AGE”; A
IF A >= 18 THEN
PRINT “YOU ARE ELIGIBLE TO VOTE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO VOTE”
END IF
END

USING SUB PROCEDURE

DECLARE SUB CHECK (A)
CLS
INPUT “ENTER YOUR AGE”; A
CALL CHECK (A)
END

SUB CHECK (A)
IF A >= 18 THEN
PRINT “YOU ARE ELIGIBLE TO VOTE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO VOTE”
END IF
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION CHECK$ (A)
CLS
INPUT “ENTER YOUR AGE”; A
PRINT “YOU ARE “;CHECK$(A)
END

FUNCTION CHECK$ (A)
IF A >= 18 THEN
CHECK$ = “ELIGIBLE TO VOTE”
ELSE
CHECK$ = “ NOT ELIGIBLE TO VOTE”
END IF
END FUNCTION

Comments

Blog27999 said…
In this manner my associate Wesley Virgin's autobiography launches in this shocking and controversial VIDEO.

Wesley was in the military-and soon after leaving-he unveiled hidden, "MIND CONTROL" tactics that the CIA and others used to obtain everything they want.

THESE are the EXACT same SECRETS lots of celebrities (notably those who "became famous out of nothing") and elite business people used to become wealthy and successful.

You've heard that you use only 10% of your brain.

That's because most of your BRAINPOWER is UNCONSCIOUS.

Perhaps that conversation has even taken place INSIDE OF YOUR very own mind... as it did in my good friend Wesley Virgin's mind around 7 years ago, while driving an unregistered, beat-up trash bucket of a vehicle with a suspended license and $3 in his pocket.

"I'm absolutely frustrated with going through life paycheck to paycheck! When will I get my big break?"

You've taken part in those questions, right?

Your success story is waiting to happen. All you need is to believe in YOURSELF.

Learn How To Become A MILLIONAIRE Fast
Unknown said…
If you're trying to lose weight then you certainly need to start following this totally brand new custom keto meal plan diet.

To create this service, certified nutritionists, fitness trainers, and top chefs united to develop keto meal plans that are effective, decent, money-efficient, and satisfying.

Since their launch in January 2019, hundreds of individuals have already completely transformed their figure and health with the benefits a great keto meal plan diet can offer.

Speaking of benefits: in this link, you'll discover eight scientifically-confirmed ones provided by the keto meal plan diet.

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