DISPLAY ALL NATURAL NOS FROM 1 TO 100, ODD, EVEN, SUM
154. WAP to display all natural numbers from 1 to 100.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 100
PRINT I,
NEXT I
END SUB
155. WAP to display all odd numbers from 1 to 100.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 100 STEP 2
PRINT I,
NEXT I
END SUB
156. WAP to display all even numbers from 2 to 100.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 2 TO 100 STEP 2
PRINT I,
NEXT I
END SUB
157. WAP to find the sum of all natural numbers from 1 to 100.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 100
S = S + I
NEXT I
PRINT “SUM OF ALL NATURAL NUMBERS FROM 1 TO 100=”; S
END SUB
159. WAP to find the sum of all odd numbers from 1 to 100.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 100 STEP 2
S = S + I
NEXT I
PRINT “SUM OF ALL ODD NUMBERS FROM 1 TO 100=”; S
END SUB
160. WAP to find the sum of all even numbers from 2 to 100.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 2 TO 100 STEP 2
S = S + I
NEXT I
PRINT “SUM OF ALL NATURAL NUMBERS FROM 1 TO 100=”; S
END SUB
161. WAP to display all natural numbers from 1 to 100 in descending order.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 100 TO 1 STEP - 1
PRINT I,
NEXT I
END SUB
162. WAP to display all odd numbers from 1 to 100 in descending order.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 99 TO 1 STEP - 2
PRINT I,
NEXT I
END SUB
163. WAP to display all even numbers from 2 to 100 in descending order.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 100 TO 2 STEP - 1
PRINT I,
NEXT I
END SUB
164. WAP to display all natural numbers from 1 to 100 also display its sum.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 100
PRINT I,
S = S + I
NEXT I
PRINT “SUM OF ALL NATURAL NUMBERS FROM 1 TO 100=”; S
END SUB
165. WAP to display all odd numbers from 1 to 100 also display its sum.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 100 STEP 2
PRINT I,
S = S + I
NEXT I
PRINT “SUM OF ALL ODD NUMBERS FROM 1 TO 100=”; S
END SUB
166. WAP to display all even numbers from 2 to 100 also display its sum.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 2 TO 100 STEP 2
PRINT I,
S = S + I
NEXT I
PRINT “SUM OF ALL EVEN NUMBERS FROM 1 TO 100=”; S
END SUB
167. WAP to display cube of all numbers from 1 to 50.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 50
PRINT I ^ 3,
NEXT I
END SUB
168. WAP to display square of all numbers from 1 to 50.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 50
PRINT I ^ 2,
NEXT I
END SUB
Comments