Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int freq[6] = {0};
- int n;
- while (scanf("%d", &n) == 1) {
- if (n < 0 || 100 < n) {
- continue;
- }
- ++freq[n / 20];
- }
- freq[4] += freq[5]; // for 100
- // 12345678901234567890123456789012345678901234567890
- // 00-000| * * * * 5 * * * *10 * * * *15 * * * *20
- printf("%17d%10d%10d%10d\n", 5, 10, 15, 20);
- for (int i = 0; i < 5; ++i) {
- printf("%2d-%3d|", i * 20, ((i != 4) ? (i + 1) * 20 - 1 : 100));
- for (int j = 0; j < freq[i]; ++j) {
- printf(" *");
- }
- puts("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement