Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int positions[50],i,y,count=0;
- char words[100],x;
- gets(words);
- for(i=0;i<=150;i++){
- if(words[i]=='\0'){
- break;
- }
- }
- y = i;
- scanf("%c",&x);
- for(i=0;i<=y;i++){
- if(x==words[i] || x-32==words[i]){
- count += 1;
- positions[count] = i+1;
- }
- }
- printf("There is/are %d \"%c\" in the above sentences.\n",count,x);
- printf("Position: ");
- for(i=0;i<=count-1;i++){
- printf("%d",positions[i+1]);
- if(i<count-1){
- printf("%c ",',');
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement