fork download
  1. #include <iostream>
  2.  
  3. int main(){
  4. using namespace std;
  5.  
  6. int
  7. N = 1234,
  8. Y = 10,
  9. X = N/Y,
  10. Q = X/Y, //Becomes 12
  11. M1 = X%Y, // Using the modulus operator
  12. M2 = X-Q*Y //Using the longer method
  13. ;
  14.  
  15. cout
  16. << "N: " << N << '\n'
  17. << "X: " << X << '\n'
  18. << "Y: " << Y << '\n'
  19. << "Q: " << Q << '\n'
  20. << "M1: " << M1 << '\n'
  21. << "M2: " << M2 << '\n'
  22. ;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
N: 1234
X: 123
Y: 10
Q: 12
M1: 3
M2: 3