TheMagnusRex

pavlova4.2

Jan 13th, 2021
606
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using namespace std;
  2.  
  3. #include <iostream>
  4.  
  5. int summ(int x){
  6.     if(x==0){
  7.         cout<<"done"<<endl;
  8.         return 0;
  9.     }
  10.     else{
  11.         cout<<x%10<<"!"<<endl;
  12.         return x%10+summ(x/10);
  13.     }
  14. }
  15.  
  16. int main(){
  17.     int a;
  18.     cout<<"input=";
  19.     cin>>a;
  20.     cout<<a<<"summ="<<summ(a);
  21.     return 0;
  22. }
RAW Paste Data