View Code of Problem 107

#include<stdio.h>
main(){
	int m,n,i,x,a[10];
	while(scanf("%d%d",&m,&n)!=EOF){
		a[10]={0,0,0,0,0,0,0,0,0,0}
		for(i=m;i<=n;i++){
			x=i;
			while(x){
				a[x%10]++;
				x=x/10;
			}
		}
		for(i=0;i<9;i++)
			printf("%d ",a[i]);
	printf("%d\n",a[9]);
	}
}
/*
Main.c:2:1: warning: return type defaults to 'int'
 main(){
 ^
Main.c: In function 'main':
Main.c:5:9: error: expected expression before '{' token
   a[10]={0,0,0,0,0,0,0,0,0,0}
         ^
Main.c:3:12: warning: unused variable 'x' [-Wunused-variable]
  int m,n,i,x,a[10];
            ^
Main.c:3:10: warning: unused variable 'i' [-Wunused-variable]
  int m,n,i,x,a[10];
          ^
*/

Double click to view unformatted code.


Back to problem 107