How to find out how many multiples of 3 are between 1 and 100

Hello,

I’m a complete beginner on development. I am learning the concept of programming through Scratch.
and I am trying to make a program called “How many multiples of “N” are between 1 and 100”.

I finally made it but I don’t think this is right code because 1 is added to the original result.
I think I can put minus 1 at the end of code but I’d like to know if I code wrong.

Thank you,

a short test

Var count As Integer = 0
Var n As Integer = TextField1.Value.ToInteger

Do
  If n * (count +1) <= 100 Then
    count = count +1
  Else
    Exit
  End If
Loop

Label1.Value = count.ToString

@Markus Rauch: please don’t solve another one’s homework.

2 Likes

@Beatrix_Willius Hello Beatrix, Just wondering why is this a homework? Does it mean, no matter how long it takes, I have to think through until the problem is solved?

Thank you!

1 Like

The question wasn’t Xojo related and you didn’t have any Xojo code.

And yes, at the beginning coding is hard.

1 Like

you could also say
if n*count<=100 then countvalid = count
output countvalid later

if you do 100.0 / 3.0 and take the integers part it should be the same result.

this Scratch is nice but not for bigger projects.
developing with source code rows are still better than visual design.
but a good visual design i saw in construct 2 for indie game development.

1 Like