Posted By

cuspajzodgraha on 04/14/15


Tagged


Versions (?)

Greyfoxov cetvrti


 / Published in: C++
 

dobro

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<cmath>
  4. using namespace std;
  5.  
  6. int main(){
  7. int N;
  8. do{
  9. cout <<"Unesite N: ";
  10. cin>>N;
  11. }while(N<0);
  12. int provjera=N, znamenka=10, suma=0;
  13. while(provjera!=0){
  14. suma=suma+(provjera%znamenka);
  15. provjera=provjera/znamenka;
  16. }
  17. cout<<suma<<endl;
  18. system("PAUSE");
  19. return 0;
  20. }

Report this snippet  

You need to login to post a comment.