Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n, s = 0;
- do {
- cout << "Unesite jedan cijeli pozitivan broj: ";
- cin >> n;
- } while (n < 0);
- while (n>0)
- {
- n /= 100;
- s += n % 10;
- n /= 1000;
- s += n % 10;
- }
- cout << s;
- system("pause>nul");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment