LegoDrifter

Lab 5 - 2

Nov 24th, 2020
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5.  
  6. int main()
  7. {
  8. int no1,no2,flag=1,tmp1,tmp2;
  9. scanf("%d%d",&no1,&no2);
  10. int reset=no2;
  11. for(int i=1;no1!=0;i++)
  12. {
  13. if(flag==0)
  14. {
  15. break;
  16. }
  17. tmp1= no1 % 10;
  18. no1 = no1 / 10;
  19. for(int j=0;no2!=0;j++)
  20. {
  21. tmp2 = no2 %10;
  22. no2 = no2 /10;
  23. if(tmp1==tmp2)
  24. {
  25. flag=1;
  26. break;
  27. }
  28. else flag=0;
  29.  
  30. }
  31. no2=reset;
  32. }
  33. if(flag==1)
  34. {
  35. printf("DA");
  36. }
  37. else if(flag==0)
  38. {
  39. printf("NE");
  40. }
  41.  
  42. return 0;
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment