Friday, October 4, 2019

Factorial

CLS
INPUT" Enter any number";N
F = 1
FOR I = 1 TO N
F = F* I
NEXT I
PRINT" Factorial=";F
END

Multiplaction table

CLS
INPUT" Enter any number":N
FOR I = 1 TO 10
PRINT N : "X": I "=": N* I
NEXT I
END

Reverse of digits

CLS
INPUT'Enter any number";N
S = 0
WHILE N < > 0
R = N MOD 10 
S = S * 10 + R
N = N / 10
WEND 
PRINT"Sum of reverse of digits=";S
END

Palindrome or not

CLS
 INPUT"Enter any number";N
A = N 
S = 0
WHILE N < > 0
R = N MOD 10
S = S * 10 + R
N = N/ 10
WEND
IF A = S THEN 
PRINT"The given number is palindrome"
ELSE
PRINT"The given number is not palindrome"
END IF 
END 

Greatest among three number

CLS
INPUT"Enter any number";A ,B , C
IF A > B and B > C THEN 
PRINT"The greatest number is";A 
ELSE IF B > A and B > C THEN
PRINT"The greatest number is "; B
ELSE 
PRINT"The greatest number is "; C
END IF 
END 

Comments


display positive, negative, or zero

CLS
INPUT" Enter any  number";N
IF N > 0 THEN 
PRINT" The number is positive"
ELSEIF N < 0 THEN
PRINT" The number is negative"
ELSE
PRINT"The number is zero"
END IF 
END

Armstrong or not

CLS
INPUT"Enter any  number";N
A = N
S = 0 
WHILE N < > 0 
R = N MOD 10 
S = S* 10 + R
N = N/ 10
WEND 
IF A = S THEN 
PRINT"The given no is armstrong"
ELSE 
PRINT" The given no is not armstong"
END IF 
END