dellboy1234
New member
- Joined
- Dec 19, 2015
- Messages
- 2
The following is a piece of code from a program
total_sum=2
For count1=3 To Step 2
MatchFlag=FALSE
For count2=2 TO INT(count1^0.5)
If INT(count1/count2)=count1/count2 Then MatchFlag=TRUE
Next count2
If MatchFlag=FALSE Then total_sum=total_sum+count1
Next count1
What does this code doand what valueis contained in the variable total_sum?
Notes
1. The line for "count1=x to To y Step z" means a loop is created in which count1 first takes value x, then x+z and so on until it equals (or exceeds) y
2. INT is a function that returns the integer part of any real number
Thanks for your help!!!!
total_sum=2
For count1=3 To Step 2
MatchFlag=FALSE
For count2=2 TO INT(count1^0.5)
If INT(count1/count2)=count1/count2 Then MatchFlag=TRUE
Next count2
If MatchFlag=FALSE Then total_sum=total_sum+count1
Next count1
What does this code doand what valueis contained in the variable total_sum?
Notes
1. The line for "count1=x to To y Step z" means a loop is created in which count1 first takes value x, then x+z and so on until it equals (or exceeds) y
2. INT is a function that returns the integer part of any real number
Thanks for your help!!!!