Computer Science, asked by Shivangi128, 8 months ago

Write a qbasic program to print sum of cubes of odd numbers between 1 and 10

Answers

Answered by devc5622
1

10 REM ‘Program to find the sum of of even numbers between 10 and 50’

20 CLS

30 LET s = 10

40 FOR i = 10 TO 50 STEP 2

50 LET s = s + i

60 NEXT i

70 PRINT "The sum of the numbers is "; s

80 END

Now, this is an easy example, and should produce a string of even numbers of the simplest sort.

For sophistication, we can add this :

10 REM ‘Program to find the sum of of even numbers between 10 and 50’

15 REM ‘Using i MOD 2 form’

20 CLS

30 LET s = 10

40 FOR i = s TO 50

50 IF i MOD 2 =0 THEN LET s = s + i

60 NEXT i

70 PRINT "The sum of the numbers is "; s

80 END

Similar questions