COUNT AND DISPLAY THE DIGITS, ODD DIGITS EVEN DIGITS REVERSED DIGITS
110. WAP to input number and count total no. of digits.
REM
CLS
INPUT "ENTER ANY NUMBER"; N
C = 0
WHILE N < > 0
C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF DIGITS"; C
END
USING SUB PROCEDURE
DECLARE SUB COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL COUNT (N)
END
SUB COUNT (N)
C = 0
WHILE N < > 0
C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF DIGITS"; C
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "TOTAL NUMBER OF DIGITS"; COUNT (N)
END
FUNCTION SUM (N)
C = 0
WHILE N < > 0
C = C + 1
N = N \ 10
WEND
COUNT = C
END FUNCTION
111. WAP to input number and count total no. of odd digits.
REM
CLS
INPUT "ENTER ANY NUMBER"; N
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF ODD DIGITS"; C
END
USING SUB PROCEDURE
DECLARE SUB COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL COUNT (N)
END
SUB COUNT (N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF ODD DIGITS"; C
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "TOTAL NUMBER OF ODD DIGITS"; COUNT (N)
END
FUNCTION SUM (N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN C = C + 1
N = N \ 10
WEND
COUNT = C
END FUNCTION
112. WAP to input number and count total no. of even digits.
REM
CLS
INPUT "ENTER ANY NUMBER"; N
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF EVEN DIGITS"; C
END
USING SUB PROCEDURE
DECLARE SUB COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL COUNT (N)
END
SUB COUNT (N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF EVEN DIGITS"; C
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "TOTAL NUMBER OF EVEN DIGITS"; COUNT (N)
END
FUNCTION SUM (N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN C = C + 1
N = N \ 10
WEND
COUNT = C
END FUNCTION
113. WAP TO ENTER ANY DIGIT AND DISPLAY EVEN DIGITS
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "EVEN DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R;
N = N \ 10
WEND
END
USING SUB PROCEDURE
DECLARE SUB EVEN (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL EVEN (N)
END
SUB EVEN (N)
PRINT "EVEN DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R;
N = N \ 10
WEND
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION EVEN (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "EVEN DIGITS ARE ";
D = EVEN(N)
END
FUNCTION EVEN (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R;
N = N \ 10
WEND
END FUNCTION
114. WAP TO ENTER ANY DIGIT AND DISPLAY ODD DIGITS
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "ODD DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R;
N = N \ 10
WEND
END
USING SUB PROCEDURE
DECLARE SUB ODD (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL ODD (N)
END
SUB ODD (N)
PRINT "ODD DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R;
N = N \ 10
WEND
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION ODD (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT " ODD DIGITS ARE ";
D = ODD(N)
END
FUNCTION ODD (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R;
N = N \ 10
WEND
END FUNCTION
115. WAP TO ENTER ANY DIGIT AND DISPLAY SQUARE OF EVEN DIGITS
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "SQUARE OF EVEN DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R ^ 2;
N = N \ 10
WEND
END
USING SUB PROCEDURE
DECLARE SUB EVEN (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL EVEN (N)
END
SUB EVEN (N)
PRINT "SQUARE OF EVEN DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R ^ 2;
N = N \ 10
WEND
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION EVEN (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "SQUARE OF EVEN DIGITS";
D = EVEN(N)
END
FUNCTION EVEN (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R ^ 2;
N = N \ 10
WEND
END FUNCTION
116. WAP TO ENTER ANY DIGIT AND DISPLAY SQUARE OF ODD
DIGITS
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "SQUARE OF ODD DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R ^ 2;
N = N \ 10
WEND
END
USING SUB PROCEDURE
DECLARE SUB ODD (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL ODD (N)
END
SUB ODD (N)
PRINT " SQUARE OF ODD DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R ^ 2;
N = N \ 10
WEND
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION ODD (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "SQUARE OF ODD DIGITS";
D = ODD(N)
END
FUNCTION ODD (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R ^ 2;
N = N \ 10
WEND
END FUNCTION
117. WAP TO ENTER ANY DIGIT AND DISPLAY CUBE OF EVEN DIGITS
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "CUBE OF EVEN DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R ^ 3;
N = N \ 10
WEND
END
USING SUB PROCEDURE
DECLARE SUB EVEN (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL EVEN (N)
END
SUB EVEN (N)
PRINT "SQUARE OF EVEN DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R ^ 3;
N = N \ 10
WEND
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION EVEN (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "CUBE OF EVEN DIGITS";
D = EVEN(N)
END
FUNCTION EVEN (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 0 THEN PRINT R ^ 3;
N = N \ 10
WEND
END FUNCTION
118. WAP TO ENTER ANY DIGIT AND DISPLAY CUBE OF ODD DIGITS
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "CUBE OF ODD DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R ^ 3;
N = N \ 10
WEND
END
USING SUB PROCEDURE
DECLARE SUB ODD (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL ODD (N)
END
SUB ODD (N)
PRINT "CUBE OF ODD DIGITS ARE ";
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R ^ 3;
N = N \ 10
WEND
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION ODD (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "CUBE OF ODD DIGITS";
D = ODD(N)
END
FUNCTION ODD (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R ^ 3;
N = N \ 10
WEND
END FUNCTION
119. WAP TO ENTER ANY DIGIT AND DISPLAY ITS REVERSED FORM
REM
CLS
INPUT "ENTER ANY NUMBER"; N
S = 0
WHILE N < > 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
PRINT "REVERSED DIGITS="; S
END
USING SUB PROCEDURE
DECLARE SUB REV (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL REV (N)
END
SUB REV (N)
S = 0
WHILE N < > 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
PRINT " REVERSED DIGITS="; S
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION REV (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT " REVERSED DIGITS="; REV (N)
END
FUNCTION REV (N)
S = 0
WHILE N < > 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
REV = S
END FUNCTION
Comments
To create this keto diet, licensed nutritionists, fitness couches, and top chefs have united to develop keto meal plans that are useful, convenient, price-efficient, and delightful.
Since their launch in January 2019, hundreds of individuals have already transformed their figure and health with the benefits a proper keto meal plan diet can give.
Speaking of benefits: in this link, you'll discover 8 scientifically-certified ones provided by the keto meal plan diet.
suppose i am converting binary no to decimal and i can't use n<>0 because binary contains only 01 and in a number if a digit is 0 how are we supposed to count ???