Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int broj;
- int broj2;
- int zbir = 0;
- cin >> broj;
- broj2 = broj;
- for(int i = 1; i <= broj2; i *= 10){
- zbir += broj % 10;
- broj /= 10;
- }
- cout << zbir;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement