04-06-2024 04:11 PM
Hello!
I need to identify all numbers divisible by 7 up to a number M, provided as input information.
In the false case it is empty, but when I let it run I also get 0 for each run of for, how do I solve this?
Solved! Go to Solution.
04-06-2024 04:36 PM - edited 04-06-2024 04:47 PM
Because your output tunnel is set to use default if unwired, which is zero.
Instead of a case structure, use a conditional output tunnel.
There should be nothing orange, right? the number of iterations is an integer. You cannot have 3.5 iterations, for example.
There is also no need to multiply by 7 if you would wire [i] to the output tunnel directly, right?
See if this can give you some ideas....
04-07-2024 04:24 AM
hmm
its not working -_-
For M=20
In result, with my program: 0 , 0 ,0 ,0 ,0 ,0 7,0 ,0 ,0 ,0 , 0 ,0 ,14
But i need: 7 , 14
04-07-2024 09:40 AM - edited 04-07-2024 09:47 AM
Obviously, you made a glaring mistake, but we cannot tell what's wrong because you failed to attach your VI!
It seems you don't understand how to do a conditional tunnel and did something, e.g. a plain indexing tunnel. Did you even look at my link?
Please attach your Vi (make sure to "save for previous", 2020 or below, first).
My code works just fine:
04-08-2024 03:02 AM - edited 04-08-2024 03:03 AM
04-08-2024 08:45 AM
04-08-2024 09:31 AM
Well, if you want to go "orange is the new blue", here's another possibility:
@jjohn1 wrote:
Not sure why you kept the orange, but this seems simpler....
Of course the original problem was to "I need to identify all numbers divisible by 7 up to a number M, provided as input information.", which is just a programming exercise that should generate all possible candidates, then identifies the ones divisible by 7. Thus my original solution is probably most appropriate (Or Gerd's detour via pink :D).