sum of square of odd numbers up to 100 AND OTHERS



169. WAP to print the sum of the numbers between 2 to 50.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 2 TO 50
S = S + I
NEXT I
PRINT “SUM OF NUMBERS BETWEEN 2 TO 50” ; S
END SUB

170. WAP to print the sum of square of odd numbers up to 100.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 1 TO 100 STEP 2
S = S + I ^ 2
NEXT I
PRINT “SUM OF SQUARE OF ODD NUMBERS UP TO 100” ; S
END SUB


171. WAP to print the sum of the numbers between 3 to 30.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 3 TO 30
S = S + I
NEXT I
PRINT “SUM OF NUMBERS BETWEEN 3 TO 30” ; S
END SUB

172. WAP to print the sum of cube of even numbers between 2 to 50.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 2 TO 50 STEP 2
S = S + I ^ 3
NEXT I
PRINT “SUM OF CUBE OF EVEN NUMBERS BETWEEN 2 TO 50” ; S
END SUB

173. WAP to print the sum of even numbers between 2 to 50.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 2 TO 50 STEP 2
S = S + I
NEXT I
PRINT “SUM OF EVEN NUMBERS BETWEEN 2 TO 50” ; S
END SUB

174. WAP using to print the sum of first ten positive integers.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 1 TO 10
S = S + I
NEXT I
PRINT “SUM OF FIRST  TEN POSITIVE INTEGERS” ; S
END SUB

175. WAP to print first ten multiples of input number.

CLS
INPUT “ENTER ANY NUMBER”; N
FOR I = 1 TO 10
PRINT N * I,
NEXT I
END

DECLARE SUB SERIES ( N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL SERIES (N)
END

SUB SERIES (N)
FOR I = 1 TO 10
PRINT N * I,
NEXT I
END SUB

176. WAP using  to display first 13 odd numbers.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
A = 1
FOR I = 1 TO 13
PRINT A,
A = A+ 2
NEXT I
END SUB


178. WAP using to display first 19 even numbers.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
A = 2
FOR I = 1 TO 19
PRINT A,
A = A+ 2
NEXT I
END SUB

179. WAP  to print the following series 9,7,5,….1.
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
FOR I = 9 TO 1 STEP-2
PRINT I
NEXT I
END SUB


180. WAP using  to display product of all numbers from 4 to 8.

DECLARE SUB SERIES ( )
CLS
CALL SERIES
END

SUB SERIES
P = 1
FOR I = 4 TO 8
P = P * I
NEXT I
PRINT “PRODUCT OF ALL NUMBERS FROM 4 TO 8”; P
END SUB

Comments

Unknown said…
Good morning, please i need help with a program that displays sum of 20 different numbers using thanks
Unknown said…
Write a program in QBASIC to display the n terms of odd number and their sum.

Please I need help on that 👆. Thanks

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