All pastes #1225847 Raw Edit

hisztogramm2

public c v1 · immutable
#1225847 ·published 2008-10-13 12:27 UTC
rendered paste body
#include <stdio.h>int main () {	int szamok[10],c;	int i= 10,max=0, maxh,j,k; 	printf("Kerem a hosszu szamot!");	while (i)		szamok[--i]=0;	while ((c = getchar())!='\n') {		if (c>='0' && c<='9'){			szamok[c-'0']++;}}	printf("\n");	printf("A hisztogramm: \n");	printf("\n");	for (i=0;i<=10;i++) {		if (szamok[i]>max) {			max=szamok[i];			maxh=i;}}	j=max;	for (i=1;i<=max;i++) {		printf("%d",j);		for (k=0;k<=8;k++){			if (szamok[k]>=j) {printf("* ");}				else {printf("  ");}}		if (szamok[9]>=j) {printf("*\n");}				else {printf(" \n");}		j--;	}	printf(" 0 1 2 3 4 5 6 7 8 9");	return 0;}