fork download
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7. system("cls");
  8. int n, tong;
  9.  
  10. cout << "Moi ban nhap vao n: ";
  11. cin >> n;
  12. tong = 0;
  13. for (int i = 0; i <= n; i++)
  14. {
  15. tong = tong + i;
  16. }
  17. cout << "Tong cua day so la: " << tong << endl;
  18. return 0;
  19.  
  20. }
Success #stdin #stdout #stderr 0.01s 5304KB
stdin
Standard input is empty
stdout
Moi ban nhap vao n: Tong cua day so la: 536756230
stderr
sh: 1: cls: not found