Advertisement
AJTAMjid2000

Exercise 2.5

Jun 15th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. int any(char s[], char t[])
  3. {
  4.     int i,j;
  5.  
  6.    
  7.     for(i=0;i<strlen(s);i++)
  8.  
  9.     {
  10.  
  11.  
  12.         for(j=0;j<strlen(t);j++)
  13.         {
  14.             if(s[i]==t[j])
  15.             {
  16.  
  17.                 return (i+1);
  18.  
  19.             }
  20.         }
  21.     }
  22.  
  23.     return -1;
  24. }
  25. int main()
  26. {
  27.     int i;
  28.     char s[1000],t[1000];
  29.     scanf("%s",s);
  30.     scanf("%s",t);
  31.     int outcome=any(s,t);
  32.     printf("%d\n",outcome);
  33.  
  34.     return 0;
  35.  
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement