Tuesday 22 October 2019

1,11,111,1111,11111

CLS
FOR I=10 TO 5
PRINT A
A=A*10+1
NEXT I
END

1,22,333,4444,55555

CLS
FOR I=1 TO 5
FOR J=1 TO I
PRINT I;
NEXT J
PRINT
NEXT I
END

1,12,123,1234,12345

CLS
FOR I=1 TO 5
FOR J= 1 TO I
PRINT J;
NEXT I 
PRINT
NEXT I
END

5,10,15,20________ up to 10th term

CLS
A=5
FOR I= 1 TO 10
PRINT A 
A=A+5
NEXT I 
END

1,4,9,10________up to 10th term

CLS 
FOR I=1 TO 10
PRINT I^2
NEXT I
END

Display 1,1,2,3,5,8_______10th term

CLS
A=1
B=1
FOR I= 1 TO 10
PRINT A
C=A+B
A=B
NEXT I 
END

Multiplication table

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

Factorial

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

Factor

CLS
INPUT"Enter any number"N
FOR I=1 TO N
IF N MOD I= O THEN PRINT I
NEXT I
END

Prime or composite

CLS
INPUT"Enter any number";N
C=0
FOR I=1 TO N
IF N MOD I=O THEN        C=C+1
NEXT I 
IF C=2 THEN
PRINT"The given number is prime"
ELSE
PRINT"The given number is composite"
END

Armstrong

CLS
INPUT"Enter any number";N
A=N
S=0
WHILE N<>0
R=N MOD 10
S= S+R^3
N=N\10
WEND
IF A=S THEN
PRINT"The given number is armstrong"
ELSE
PRINT"The number is not armstrong"
ENDIF 
END

Palindrome

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"
ENDIF 
END

Reverse digit

CLS
INPUT"Enter any number";N
S=0
WHILE N<>0
R=N MOD 10
S=S*10+R
N=N\10
WEND
PRINT"Reverse digit";R
END

Display product of digits

CLS 
INPUT"Enter any number";N
P=1
WHILE N<>0
R=N MOD 10
P=P*R
N=N\10
WEND 
PRINT"Product of digit=";P
END

Display sum of digit

CLS
INPUT"Enter any number";N
S=0
WHILE N<>0
R=N MOD 10
S=S+R
N=N\10
WEND
PRINT"Sum of digit=";S
END

Display greatest among three number

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

Display odd or even

CLS
INPUT"Enter any number";N
IN N MOD 2 = 0 THEN
PRINT"The number is odd"
ELSE
PRINT"The number is zero"
ENDIF
END

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"Given number is negative"
ELSE
PRINT"Given number is zero"
ENDIF 
END

WAP to find the volume of cylinder

CLS
INPUT"Enter radius";R
INPUT"Enter height";H
V=22/7*R^2*H
PRINT"Volume of cylinder";V
END

WAP to find the area of cube

CLS
INPUT"Enter length";L
A=L^3
PRINT"Area of cube";A
END

WAP to find the area of volume of box

CLS
INPUT"Enter length";L
INPUT"Enter breadth";B
INPUT"Enter height";H
V=L*B*H
PRINT"Volume of box";V
END

WAP to find the area of four walls

CLS 
INPUT"Enter length";L
INPUT"Enter breadth";B
INPUT"Enter height";H
A=2*H*(L+B)
PRINT"Area of four wall";A
END

WAP to find the area of square

CLS 
INPUT"Enter length";L
A=L^2
PRINT"Area of square";A
END

WAP to find the area of traingle

CLS 
INPUT"Enter height";H
INPUT"Enter breadth";B
A=1/2*B*H
PRINT"Area of traingle";A
END

WAP to find the area of circle

CLS
INPUT"Enter radius";R
A=22/7*R^2
PRINT"Area of circle";A
END

WAP to find the area of rectangle

CLS
INPUT"Enter length";L
INPUT"Enter breadth";B
A=L*B
PRINT"Area of rectangle";A
END