#include main(){ char a[2000]; int i, n; printf("Input letters.\n"); gets( a );/* 改行まで文字列の入力 */ n = 0 ; i = 0 ; while( a[i] != 0 ){ if( a[i]=='r' ){ /* イコールは== */ n = n + 1 ; } i = i + 1 ; } printf("number of letter 'r' in '%s' is %d\n", a, n); }