SHARE
TWEET

Untitled

a guest Nov 14th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main ()
  5. {
  6.  
  7.   char string1[80];
  8.   char string2[80];
  9.   char string3[80];
  10.   char *str1;
  11.   char *str2;
  12.   char *str3;
  13.   char test;
  14.   int count=0;
  15.  
  16.  
  17.   printf("Enter a line of text: ");
  18.   fgets(string1,80,stdin);
  19.   printf("Enter a second line of text: ");
  20.   fgets(string2,80,stdin);
  21.   printf("Enter a final line of text: ");
  22.   fgets(string3,80,stdin);
  23.  
  24.   str1=strchr(string1,'k');
  25.  
  26.   while(str1!=NULL)
  27.   {
  28.     count++;
  29.   }
  30.   printf("\nFound k %d times",count);
  31.   return 0;
  32. }
RAW Paste Data
Top