Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- {
- char string[254];
- char letter;
- int i;
- int count = 0;
- printf("Gib einen Satz an: \n");
- fgets(string, sizeof(string), stdin);
- printf("Welcher Buchstabe soll gesucht werden?\n");
- scanf("%c", &letter);
- for( i = 0; string[i] != '\0'; i++ )
- {
- if( string[i] == letter)
- {
- count++;
- }
- }
- printf("Der Buchstabe %c kommt %d mal vor\n", letter, count );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement