fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char a[20];
  6. char ch;
  7. int count=0;
  8. printf("enterr the string:");
  9. scanf("%s",&a);
  10. printf("enterr the character:");
  11. scanf("%c",&ch);
  12. for(int i=0;a[i];i++)
  13. {
  14. if(a[i]==ch)
  15. {
  16. count++;
  17. }
  18. }
  19. printf("the repeated occurence of the character is:%d",count);
  20. return 0;
  21. }
Success #stdin #stdout 0s 5264KB
stdin
Standard input is empty
stdout
enterr the string:enterr the character:the repeated occurence of the character is:0