Posts

Showing posts from October, 2019

1,11,111,1111,11111

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

1, 12, 123,1234,12345

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

1,1,2,3,5,.....up to 10th term

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

1,4,9 up to 10th term

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

5, 10 ,15, 20 , to .....10th term

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

Multiplication of 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 F = 1 FOR I =1 NEXT I PRINT " Factorial ="; F END

Factors

CLS INPUT " Enter any number "; N FOR I = 1 TO N IF N MOD I = 0 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 = 0 THEN C= C + 1 NEXT I IF C =2 THEN PRINT " The given no is prime " ELSE PRINT " The given no is composite " 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 = 5 THEN PRINT " The given number is armstrong " ELSE PRINT " The giver number is not armstrong " END IF END

Palindrome or not

CLS  INPUT " Enter any number "; N A = S 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 palindrome " ELSE PRINT " The given no is not palindrome " END IF 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 " Reverse of digits "; S END 

Product of digits

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

Sum of digits

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 digits "; S END

Greatest among 3 numbers

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

Display odd or even

CLS INPUT "Enter any Number "; N IF N MOD 2 = 0 THEN PRINT "The Number is even" ELSE PRINT "The Number is odd" END IF END

WAP to find the positive negative or zero

CLS INPUT " Enter any number "; N IF N > 0 THEN PRINT " The number is positive " ELSE IF N < 0 THEN PRINT " Given number is negative " ELSE PRINT " Given number is zero " END IF 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 volume of cube

CLS INPUT " Enter Length "; L V = L^ 3 PRINT " Volume of cube "; V END

WAP to find the 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 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 walls "; A END

WAP to find area of square

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

WAP to find area of triangle

CLS INPUT " Enter Height "; H INPUT " Enter Base "; B A = 1/2 * B * H PRINT " Area of triangle "; A END

WAP to find 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