Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void f(long n)
- {
- if (n!=0)
- {
- if (n%2==0)
- {
- cout<<n%10;
- }
- f(n/10);
- if (n%2!=0)
- {
- cout<<n%10;
- }
- }
- else
- {
- cout<<endl;
- }
- }
- int main()
- {long n;
- cout <<"N=";cin>>n;
- f(n);
- return 0;
- }
- #include <iostream>
- using namespace std;
- void f (int b)
- {
- if(3<=b)
- {
- f(b-2);
- cout<<'*';
- }
- else
- {
- cout<<b;
- }
- }
- int main()
- {int b;
- cout <<"B=";cin>>b;
- f(b);
- return 0;
- }
- #include <iostream>
- using namespace std;
- int f (int n)
- {
- int c;
- if (n!=0)
- {
- if (n%2==1)
- {
- c=1+f(n/2);
- }
- else
- {
- c=f(n/2);
- }
- cout<<n%2;
- return c;
- }
- else
- {
- return 0;
- }
- }
- int main()
- {int n;
- cout<<"N=";cin>>n;
- cout <<f(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement