Any problem with this code
#include<stdio.h>
/*Counts digits, white numbers, others*/
main()
{
int c, i, nwhite, nother;
int ndigit[10];
nwhite=nother=0;
for(i=0; i<10; ++i)
ndigit[i]=0;
while((c=getchar())!=EOF)
if(c>='0' && c<='9')
++ndigit[c-'0'];
else if(c==' ' || c=='\n' || c=='\t')
++nwhite;
else
++nother;
printf("digits= ");
for(i=0; i<10; ++i)
printf("%d ", ndigit[i]);
printf("\nwhitespace=%d, other=%d\n", nwhite, nother);
}
2 Answers
Top contributors in Uncategorized category
Unanswered Questions
J88 Company
Answers: 0
Views: 7
Rating: 0
fb88black
Answers: 0
Views: 16
Rating: 0
why do you like to swim?
Answers: 0
Views: 21
Rating: 0
M88 BOO
Answers: 0
Views: 119
Rating: 0
M88 BOO
Answers: 0
Views: 21
Rating: 0
868vipsale
Answers: 0
Views: 17
Rating: 0
868vipsale
> More questions...
Answers: 0
Views: 20
Rating: 0