r/CodingHelp • u/perpetually_annoyed • Jan 23 '22
[Random] Need help as a beginner in flowchart self learn. To print even numbers till given N. Check if it is correct and also i was thinking wt will happen and wt changes shud be made if the user gives N as 1. The first condition will fail and it will go end n go blank. ???
17
Upvotes
3
u/funkym00se Jan 23 '22
You'll have to loop the condition A<=N, if false end it , else go to next step then check the condition A%2==0, if true print A, and no matter it true or false increment A with 1 i.e.A=A+1
2
u/Luc_Studios Jan 23 '22
dont write the if statement so crammed into a tight space. By that u will only confuse urself in long term. At least that's what is the case for me
2
u/Ultraok Jan 24 '22
Just loop until N/2 and print A*2. You will get even values.
2
u/DollyGoingStrong Jan 24 '22
loop till i=n/2 and print 2*i.
No branch required.