Posts

Showing posts from October, 2019

Qbasic

Program to find the factors of a number using FUNCTION DECLARE FUNCTION FACT(N) CLS INPUT"ENTER ANY NUMBER";N PRINT"FACTOR=";FACT(N) END FUNCTION FACT(N) FOR I= 1 TO N IF N MOD I=0 THEN PRINT I NEXT I END FUNCTION Program to check whether the given no is armstrong number or not using FUNCTION DECLARE FUNCTION ARM(N) CLS INPUT"ENTER ANY NUMBER";N A=P P=ARM IF A=P THEN PRINT"The given no is armstrong" ELSE PRINT"The given no is not armstrong" END IF END FUNCTION ARM(N) S=0 WHILE N<>0 R=N MOD 10 S=S+R^3 N=N\10 WEND ARM=S END FUNCTION Program to check whether the given word is palindrome string or not using FUNCTION DECLARE FUNCTION PAL$(N$) CLS INPUT"ENTER ANY WORD";N$ P$=PAL$(N$) IF N$=P$ THEN PRINT"The given word is palindrome" ELSE PRINT"The given word is not palindrome" END FUNCTION PAL$(N$) FOR I= LEN$(N$) TO 1 STEP -1 B$= MID$(N$,I,1) C$=C$+B$ NEXT I PAL$=C$ END FUNCITON Program to check whether th