Advertisement
Dizzy3113

Untitled

Nov 3rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void cifre(int nr, int &nc, int &sc)
  5. {
  6. nc=sc=0;
  7. while(nr){
  8. nc++;
  9. sc=sc+nr%10;
  10. nr=nr/10;
  11.  
  12. }
  13. }
  14. int main()
  15. {
  16. int nc, sc, nr=3334;
  17. cifre(nr, nc, sc);
  18. cout<<nc<<" "<<sc;
  19.  
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement