Crazy

isti znaci vo stringovi

Dec 14th, 2016
96
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. #include <string.h>
  3. #define MAX 100
  4.  
  5.  
  6. void Resenie(char *s, char *s1){
  7. int promena=0,n,i;
  8. if(strlen(s) < strlen(s1)) n=strlen(s);
  9. else n=strlen(s1);
  10.  
  11. for(i=0;i<n;i++){
  12.     if(s[i]==s1[i]&&s[i]!='\0'){
  13.         s[i]='*';
  14.         s1[i]='*';
  15.         promena++;
  16.     }
  17. }
  18.  
  19. printf("%d\n",promena);
  20.  
  21. printf("%s\n%s",s,s1);
  22.  
  23. }
  24.  
  25.  
  26. int main(){
  27.  
  28.     char s[MAX],s1[MAX];
  29.     gets(s);
  30.     gets(s1);
  31.     Resenie(s,s1);
  32.  
  33. }
Add Comment
Please, Sign In to add comment