neogz

zbir cifara

Nov 24th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.  
  5.     int broj, suma=0;
  6.  
  7.     cout << "Unesi jedan trocifreni broj: ";
  8.     cin >> broj;
  9.  
  10.     do
  11.     {
  12.         suma += broj % 10;
  13.         broj /= 10;
  14.     } while (broj>0);
  15.  
  16.         cout << suma;
  17.  
  18.     system("pause > nul");
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment