Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- freopen("SN.TXT" , "r", stdin );
- freopen("TONG.TXT", "w", stdout);
- int x, tong = 0;
- cout << "Tong cua cac so ";
- while (cin >> x) {
- if (x > 0) {
- cout << x << ' ';
- tong += x;
- }
- }
- cout << "la: " << tong;
- }
Advertisement
Add Comment
Please, Sign In to add comment