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