Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace cifre001
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int a = 0, b = 0, k = 0, p = 0, c = 0;
  14. a = int.Parse(Console.ReadLine());
  15. b = int.Parse(Console.ReadLine());
  16. int auxa = a, auxb = b;
  17. while(a!=0)
  18. {
  19. p++;
  20. a /= 10;
  21. }
  22. while(b!=0)
  23. {
  24. k++;
  25. b /= 10;
  26. }
  27. if (p != k)
  28. Console.WriteLine("NU");
  29. else
  30. {
  31. Console.WriteLine("DA");
  32. }
  33. while (auxa != 0 && auxb != 0)
  34. {
  35. if (auxa % 10 == auxb % 10)
  36. c++;
  37. auxa /= 10;
  38. auxb /= 10;
  39. }
  40. Console.ReadKey();
  41. Console.WriteLine(c);
  42. Console.ReadKey();
  43.  
  44.  
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement