(a)WAP to Enter 15 numbers and display it.
REM
CLS
DIM N(15)
FOR I=1 to 15
INPUT"Enter the numbers";N(I)
NEXT I
PRINT"The entered numbers are"
FOR J= 1 TO 15
PRINT N(J);
NEXT J
END
(b)Enter 15 numbers and display it in opposite form.
REM
CLS
DIM N(15)
FOR I= 1 to 15I
NPUT"Enter the numbers";N(I)
NEXT I
PRINT"The entered numbers in opposite form are"
FOR J= 15 to 1 STEP -1
PRINT N(J);
NEXT J
END
(c)Enter 20 numbers and display the even numbers.
REM
CLS
DIM N(20)
FOR I=1 to 20
INPUT"Enter the numbers";N(I)
NEXT I
PRINT"The even numbers are"
FOR J= 1 TO 20
IF N(J) MOD 2=0 THEN
PRINT N(J)
END IF
NEXT J
END
(d)Enter 20 numbers and display the odd numbers.
REM
CLS
DIM N(20)
FOR I=1 to 20
INPUT"Enter the numbers";N(I)
NEXT I
PRINT"The odd numbers are"
FOR J= 1 TO 20
IF N(J) MOD 2<>0 THEN
PRINT N(J)
END IF
NEXT J
END
(e)Enter 25 numbers and display sum of numbers.
REM
CLS
DIM N(25)
FOR I=1 TO 25
INPUT"Enter the numbers";N(I)
S=S+N(I)
NEXT I
PRINT"The Sum of 25 numbers are";s
END
(f)Enter 25 numbers and display sum of even numbers.
REM
CLS
DIM N(25)
FOR I=1 TO 25
INPUT"Enter the numbers";N(I)
IF N(I) MOD 2=0 THEN S=S+N(I)
NEXT I
PRINT"The Sum of even numbers are";s
END IF
END
(g)Enter 25 numbers and display sum of odd numbers.
REM
CLS
DIM N(25)
FOR I=1 TO 25I
NPUT"Enter the numbers";N(I)I
F N(I) MOD 2<>0 THEN S=S+N(I)
NEXT I
PRINT"The Sum of odd numbers are";s
END IF
END
(h)Enter 30 numbers and display all the numbers as well as it's sum.
REM
CLS
DIM N(30)
FOR I=1 TO 30
INPUT"Enter the numbers";N(I)
NEXT I
PRINT"the entered numbers are"
FOR J=1 TO 30
PRINT N(J)
S=S+N(J)
NEXT J
PRINT"Sum of 30 numbers =";s
END
(i)Enter 30 numbers and display all the odd numbers as well as it's sum.
REM
CLS
DIM N(30)
FOR I=1 TO 30
INPUT"Enter the numbers";N(I)
NEXT I
PRINT"the odd numbers are"
FOR J=1 TO 30I
F N(J) MOD 2<>0 THENPRINT N(J),
S=S+N(J)
END IF
NEXT J
PRINT"Sum of odd numbers =";s
END
(j)Enter 30 numbers and display all the even numbers as well as it's sum.
REM
CLS
DIM N(30)
FOR I=1 TO 30
INPUT"Enter the numbers";N(I)
NEXT I
PRINT"the even numbers are"
FOR J=1 TO 30
IF N(J) MOD 2=0 THENPRINT N(J),
S=S+N(J)
END IF
NEXT J
PRINT"Sum of even numbers =";s
END
* * *
No comments:
Post a Comment