fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Introduc variabilele a, b, c şi x;
  6. int a, b, c, x;
  7. // Citesc a, b, c, x;
  8. cin >> a >> b >> c >> x;
  9. if (c == x % 10) {// verificam "c"
  10.  
  11.  
  12. // Introduc variabila “cnt” sa numar cifrele;
  13. int cnt = 0;
  14. // parcurg x;
  15. int x_copy;
  16. while (x > 0) {
  17. ++cnt;
  18. x_copy = x;// verificam "b" introducand o variabila copie a lui x
  19. //pentru a mentine penultima valoare a lui x
  20. x /= 10;
  21.  
  22. }
  23. if (b == x_copy) {
  24. cout <<"DA";
  25. }else{
  26. cout <<"NU";
  27. }
  28. //cout << cnt;// verificam "a"
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5272KB
stdin
6 4 2 489643
stdout
Standard output is empty