/* atk1 h8t4 */ #include #define N 200 int calc_char(char text[],char c); main() { char c, text[N]; int i=0; printf("Enter a line of text:\n"); while( (c=getchar()) != '\n' ) { text[i]=c; i++; } text[i]='\0'; printf("\nEnter a character: "); scanf("%c",&c); printf("\nIn the text you entered, the character %c occurs %d time(s).\n\n", c,calc_char(text,c)); } int calc_char(char text[],char c) { int count,i; for(i=0,count=0;text[i]!='\0';i++) if(text[i]==c) count++; return count; }