Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void cifre(int nr, int &nc, int &sc)
- {
- nc=sc=0;
- while(nr){
- nc++;
- sc=sc+nr%10;
- nr=nr/10;
- }
- }
- int main()
- {
- int nc, sc, nr=3334;
- cifre(nr, nc, sc);
- cout<<nc<<" "<<sc;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement