+ 1
Determine if the sum of 2 numbers is odd or even
Hi! I'm in my senior in highschool with zero to none experience and knowledge about programming and I'm not sure if this is the right place to ask but I'm desperate for answers. In my computer programming class my teacher asked us to create a Flowchart that determines if the sum of 2 numbers is odd or even and I didn't quite understand it. So if anyone is kind enough to draw one for me and explain to me how everything works like the shapes and their meanings I'll be very very grateful.
2 Answers
+ 1
@Calvin Condition should be sum variable % 2 = 0.If that is true than its even else its odd.
@Gab You should use the % operator because if the sum is even and you divide it with 2 then the remainder will be 0.If the sum is odd then the remainder will not be 0.Thus, it is odd.
if (sum variable % 2 == 0)
Print (even);
else
Print (odd);
Hope this helps. đ
0
Set variable of first number
âŹ
Set variable of second number
âŹ
Set variable of the sum of the 2 variables
âŹ
Condition: Check if the sum variable % 2 is true
âŹ
If yes, the answer is even, else the answer is odd.