Trying to establish a counter with multiple buttons

Hello!

I’m trying to make a project with this situation.

There are 6 push buttons that can be pressed.

When I press one button a counter will show 1 on the screen and it will continue showing one until it is released, when released it must show 0.

And The same, if I press two buttons or three or four it must show the number of buttons pressed, and update continuously, for example if I press three buttons but I release only one it must show two on the counter.

I had previously researched but I can‘t find something similar...

How can I make this in code?

I will appreciate a lot your help. Thank you.

See attached numButtons.ino

The delay(100) in loop() act as a crude debouncer. If you need faster refresh then it needs a better debouncing

numButtons.ino (551 Bytes)

Do post your current best attempt.

This has all the hallmarks of a school assignment, isn't it?