Final answer:
To find the sum of numbers divisible by 4, use a loop to accept numbers and add them to the sum if divisible by 4. Display the final sum.
Step-by-step explanation:
To find the sum of numbers divisible by 4, you can use a loop to continuously accept numbers and check if they are divisible by 4. Here is the pseudo-code:
- Initialize a variable 'sum' to 0.
- Initialize a variable 'userInput' to 0.
- Start a loop:
- Ask the user for a number.
- Accept the number as 'userInput'.
- If 'userInput' is divisible by 4, add it to the 'sum'.
- Ask the user if they want to continue.
- If the user wants to continue, repeat the loop. Otherwise, exit the loop.
- Display the final 'sum'.
This pseudo-code will repeatedly prompt the user for numbers, add the ones divisible by 4 to the sum, and keep a running total until the user chooses to stop. Finally, it will display the final sum.
Learn more about sum of numbers divisible by 4