Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int SUMA_CYFR(int &x)
- {
- int suma = 0;
- int y=0;
- do
- {
- y = x % 10;
- suma +=y;
- x = x / 10;
- } while (x > 0);
- x = suma;
- return x;
- }
- int main()
- {
- int x;
- cout << "Podaj liczbe: " << endl;
- cin >> x;
- do {
- SUMA_CYFR(x);
- } while (SUMA_CYFR(x) > 10);
- cout << SUMA_CYFR(x);
- }
Advertisement
Add Comment
Please, Sign In to add comment