write a Qbasic program to find the sum of squares of odd number up to 10
Answers
Answered by
5
Question:-
- To find the sum of squares of odd numbers up to 10
Code Language:-
- QBASIC
QBASIC CODE:-
CLS
FOR I=1 TO N
IF I MOD 2 <> 0
S=S+ (I^2)
NEXT I
PRINT "SUM="+S
END
Explaination:-
- The program runs a loop from 1 to 10
- In each iteration, if loop value is odd then Variable S calculates the sum of squares of odd numbers
- Once the loop value becomes greater then 10, loop terminates
- Finally, Sum gets printed and the program ends
anindyaadhikari13:
Awesome!
Similar questions