fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int i = 42;
  8. int j = 12;
  9. int k = 33;
  10.  
  11. cout << "i = " << i << endl;
  12. cout << "j = " << j << endl;
  13. cout << "i+j = " << i+j << endl;
  14. cout << "i-j = " << i-j << endl;
  15. cout << "i*j = " << i*j << endl;
  16. cout << "i/j = " << i/j << endl;
  17. cout << "i%j = " << i%j << endl;
  18.  
  19. k = i/2;
  20. cout << "i/2 = " << k << endl;
  21.  
  22. k = i/3;
  23. cout << "i/3 = " << k << endl;
  24.  
  25. k = i-2*j;
  26. cout << "i-2*j = " << k << endl;
  27.  
  28. i++;
  29. cout << "i after increment: " << i << endl;
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 2728KB
stdin
Standard input is empty
stdout
i = 42
j = 12
i+j = 54
i-j = 30
i*j = 504
i/j = 3
i%j = 6
i/2 = 21
i/3 = 14
i-2*j = 18
i after increment: 43