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) {// daca restul lui x e egal cu c
  10.  
  11.  
  12. // Introduc variabila “cnt” sa numar cifrele;
  13. int cnt = 0;
  14. // parcurg x;
  15. while (x > 0) {
  16. ++cnt;
  17. b = x;
  18. x /= 10;
  19.  
  20. }
  21. cout << b;
  22. //cout << cnt;// cnt = "a"
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5300KB
stdin
6 4 3 489643
stdout
4