Untitled
unknown
plain_text
4 years ago
534 B
4
Indexable
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char str[100]; int i = 0, times = 0; printf("Input a string of characters ending with '#': "); char ch = getchar(); while(ch != '\n'){ str[i] = ch; ch = getchar(); i++; } for(int j = 0; j < str[j] != '#'; j++){ if(str[j] == 'o' && str[j+1] == 'f'){ times++; } } printf("The number of times that the sequence in:%d\n", times); return 0; }
Editor is loading...