Lucian_Adrian

#57 n_Suma

Oct 5th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,S=0,x;
  8. ifstream fisierin("n_suma.in");
  9. fisierin>>n;
  10. while(fisierin>>x)
  11. S+=x;
  12. fisierin.close();
  13. ofstream fisierout("n_suma.out");
  14. fisierout<<S;
  15. fisierout.close();
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment