QBASIC Program To Check Whether A Number Is Palindrome Or Not
QBASIC Program To Check Whether A Number Is Palindrome Or Not
CLS
INPUT" Enter a number"; N
LET M=N
WHILE N<>0
R=N MOD 10
A=A*10+R
N=N\10
WEND
IF M=A THEN
PRINT"The number is palindrome"
ELSE
PRINT"The number is not palindrome";
END IF
END
QBASIC Program To Check Whether A Number Is Palindrome Or Not Using SUB Procedure
DECLARE SUB PALIN(N)
CLS
INPUT" Enter a number"; N
CALL PALIN(N)
END
SUB PALIN(N)
LET M=N
WHILE N<>0
R=N MOD 10
A=A*10+R
N=N\10
WEND
IF M=A THEN
PRINT"The number is palindrome"
ELSE
PRINT"The number is not palindrome";
END IF
END SUB
QBASIC Program To Check Whether A Number Is Palindrome Or Not Using FUNCTION Procedure
DECLARE FUNCTION PALIN$(N)
CLS
INPUT"Enter a number"; N
PRINT PALIN$(N)
END
FUNCTION PALIN$(N)
LET M=N
WHILE N<>0
R=N MOD 10
A=A*10+R
N=N\10
WEND
IF M=A THEN
PALIN$="The number is palindrome"
ELSE
PALIN$="The number is not palindrome";
END IF
END FUNCTION
Comments
Post a Comment