fork download
  1. // <24127121>
  2. // <Nguyen Tien Thanh>
  3. // <24C09>
  4. //Bai 10
  5.  
  6. //Test case 1
  7. //input: 60 80
  8. //Output: 20
  9.  
  10. //Test case 2
  11. //Input: 70 100
  12. //Output: 30
  13.  
  14. //Test case 3
  15. //Input: 10 100
  16. //Output: 90
  17. #include <iostream>
  18. using namespace std;
  19. int main() {
  20. unsigned int previous, current;
  21. do {
  22. cout << "Nhap vao previous va current: ";
  23. cin >> previous >> current;
  24. if (current <= previous) {
  25. cout << "Yeu cau nhap lai." << endl;
  26. }
  27. } while (current <= previous);
  28. unsigned int used = current - previous;
  29. cout << " " << used << endl;
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5320KB
stdin
50 60
stdout
Nhap vao previous va current:  10