Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int SUMA_CYFR(int n)
- {
- int x=0;
- for(n; n>0; n=n/10)
- {
- x=x+(n%10);
- }
- return x;
- }
- int main()
- {
- cout << SUMA_CYFR(456) << endl;
- cout << SUMA_CYFR(1578) << endl;
- cout << SUMA_CYFR(34) << endl;
- int a;
- cin >> a;
- while(a>9)
- {
- a=SUMA_CYFR(a);
- }
- cout << a;
- return 0;
- }
Add Comment
Please, Sign In to add comment