I need logic to the following program:
The input is like
2, 3.4, 5, 2.2, 4.6, 5.7, 3.6 .....
The output should be sorted out as:

0-2 :1
2-4: 3
4-6: 3
6-8: 0

The numbers are checked if they are in a particular range and the counter is increased accordingly.
How can this be implemented?I need some help with the logic.