fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. // adicion
  7. cout << 2 + 3 << endl;
  8.  
  9. // sustraccion
  10. cout << 3 - 2 << endl;
  11.  
  12. // multiplicacion
  13. cout << 2 * 3 << endl;
  14.  
  15. // division enteros
  16. cout << 3 / 2 << endl;
  17.  
  18. // division entre floats
  19. cout << 3 / 2.0f << endl;
  20.  
  21. // modulo: retorna el resto de una division
  22. cout << 3 % 2 << endl;
  23.  
  24. // uso de parentesis para agrupar
  25. cout << 1 + 2 * 3 + 4 << endl;
  26. cout << (1 + 2) * (3 + 4) << endl;
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
5
1
6
1
1.5
1
11
21