-->
Showing posts with label function procedure. Show all posts
Showing posts with label function procedure. Show all posts

Tuesday, June 10, 2025

Qbasic program to get output using dry run table | SEE computer science programming guide in Qbasic -to find sum of 1 to 9 with 2 step increment

 QBasic programs collection-Especially for SEE (Grade-10)


QBasic program to know the output of program using dry run table- to find the sum of numbers between 1 and 9 using function procedure

declare function find()

Print find

End

Function find ()

    For n = 1 To 9 Step 2

        Let s = s + n

    Next n

    find = s

End Function

Dry run table

N=1 to 9 step 2

S=s+n

find

 

N=1;true

S=0+1=1

 

 

N=3;true

S=1+3=4

 

 

N=5;true

S=4+5=9

 

 

N=7;true

S=9+7=16

 

 

N=9;true

S=s+N=16+9=25

 

 

N=11;false

 

Find=s=25

 


output

25