Qbasic program to find the square of natural numbers till 10.
Answer fast.
Spam messages will be reported.
Answers
Answered by
2
Solution:
The given problem is solved using QBASIC.
CLS
SUM = 0
FOR I = 1 TO 10
SUM = SUM + I ^ 2
NEXT I
PRINT "Sum of squares of natural number till 10 ="; SUM
END
Explanation:
- Line 1: Clears the screen.
- Line 2: Initialise SUM = 0 to store the sum of squares of natural numbers.
- Line 3: Loop from numbers 1 to 10
- Line 4: Add the square of the numbers and store the result in sum variable.
- Line 5: End of for loop.
- Line 6: Displays the sum.
- Line 7: End of program.
See attachment for output.
Attachments:
anindyaadhikari13:
Thanks for the brainliest ^_^
Similar questions