Posted By


cuspajzodgraha on 04/14/15

Tagged


Statistics


Viewed 88 times
Favorited by 0 user(s)

Greyfoxov cetvrti


/ Published in: C++
Save to your folder(s)

dobro


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.