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

Unknown said…
IS THIS LOOPING IN QBASIC
coolguy said…
Can you do one program odd number from 1 to 10 ,using of FUNCTION PROCEDURE

Popular posts from this blog

PROGRAM TO FIND SQUARE, CUBE, SQUARE ROOT AND CUBE ROOT OF GIVEN NUMBER

PROGRAM TO DISPLAY SUM, PRODUCT, DIFFERENCE AND PRODUCT OF TWO / THREE NUMBERS

PALINDROME AND ARMSTRONG PROGRAMS