fork download
  1. #include <iostream>
  2. using namespace std;
  3. /*
  4. Ideea generala:
  5. Daca Pretul produsului se imparte fara rest la 10 sau la 5, afisez "DA".
  6. Altfel, afisez "NU".
  7.  
  8. Pasii de rezolvare:
  9. Declar si citesc pretul produsului.
  10. Daca restul impartirii acestuia la "10" sau la "5" este egal cu "0":
  11. Afisez "DA".
  12. Altfel, afisez "NU".
  13. Teste:
  14. 7 -> NU
  15. 4 -> NU
  16. 1 -> NU
  17. 100 -> DA
  18. 10 -> DA
  19. 5 -> DA
  20. 35 -> DA
  21. 45 -> DA
  22. 34 -> NU
  23. 96 -> NU
  24. 95 -> DA
  25. */
  26. const int TEN = 10;
  27. const int FIVE = 5;
  28.  
  29. int main() {
  30. int x;
  31. cin >> x;
  32. if (x % TEN == 0 || x % FIVE == 0) {
  33. cout << "DA";
  34. } else {
  35. cout << "NU";
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0.01s 5292KB
stdin
36
stdout
NU