Posts

Showing posts from November, 2013

Assignment for class IX (part iii)

WAP to enter any number and display:            1.     To reverse the given digits .  Ans   à REM CLS S=0 INPUT “Enter a number”; N WHILE N<>0 R=N MOD 10 S=S * 10 + R N=N\10 WEND PRINT “The reverse number is”; S END 2.       To display product of entered digits.  Ans   à REM CLS P=1 INPUT “ENTER A NUMBER”; N WHILE N<>0 R= N MOD 10 P= P *R N= N\10 WEND PRINT “THE PRODUCT OF ENTERED DIGITS IS”; P END 3.     To display product of even digits.  Ans   à REM CLS P=1 INPUT “ENTER A NUMBER”; N WHILE N<>0 R= N MOD 10 IF R MOD 2=0 THEN P= P*R N=N\10 WEND PRINT “THE PRODUCT OF EVEN DIGITS IS”; P END 4.     To display product of odd digits.  Ans   à REM CLS P=1 INPUT “ENTER A NUMBER”; N WHILE N<>0 R= N MOD 10 IF R MOD 2=1 THEN P= P*R N=N\10 WEND PRINT “THE...

Assignment for class IX (part ii)

WAP to enter any number and display:            1.     Sum of digits.  Ans   à REM CLS S: 0 INPUT “ENTER A NUMBER”;N WHILE N <> 0 R = N MOD 10 S = S + R N = N \10 WEND PRINT “SUM OF DIGITS IS” ; S END 2.     Sum of even digits. Ans   à REM CLS S: 0 INPUT “ENTER A NUMBER”;N WHILE N <> 0 R = N MOD 10 IF R MOD 2 = 0 THEN S = S + R N = N \10 WEND PRINT “SUM OF EVEN DIGITS IS ” ; S END 3.     Sum of odd digits. Ans   à REM CLS S: 0 INPUT “ENTER A NUMBER”;N WHILE N <> 0 R = N MOD 10 IF R MOD 2 = 1 THEN S = S + R N = N \10 WEND PRINT “SUM OF ODD DIGITS IS” ; S END 4.     Sum of square of digits. Ans   à             REM CLS S=0 INPUT “ENTER A NUMBER”; N WHILE N<>0 R= N MOD 10 S = S+R^2...

Assignment for class IX

WAP to Display: 1.                              J            JA            JAG            JAGA            JAGAT Ans   à REM CLS S$=”JAGAT” FOR I=1 TO LEN(S$)              PRINT LEFT$(S$, I)                       NEXT I END 2.               T            AT GAT AGAT JAGAT Ans   à REM CLS S$=”JAGAT” FOR I=1 TO LEN(S$) PRINT RIGHT$(S$,I) NEXT I END 3. JAGAT JAGA JAG...