Răspuns :
Răspuns:
1.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{unsigned int n,copn,nr,x;
cin>>n;
copn=n;
nr=0;
x=n%10;
while (copn>0)
{nr=nr+1;
copn=copn/10;}
cout<<pow(10,nr-1)*x+n/10;
return 0;
}
2 .
#include <iostream>
using namespace std;
int main()
{unsigned int n;
float s,nr;
cin>>n;
s=nr=0;
while (n>0)
{if (n%10==2 || n%10==3 ||n%10==5 ||n%10==7)
{s=s+n%10;
nr=nr+1;}
n=n/10;}
cout<<s/nr;
return 0;
}
3.
#include <iostream>
using namespace std;
int main()
{unsigned int n,copn,x,mini,ogl;
cin>>n;
copn=n;
mini=10;
x=ogl=0;
while (copn>0)
{if (copn%10<mini)
mini=copn%10;
copn=copn/10;}
copn=n;
while (copn>0)
{if (copn%2==1)
x=x10+mini;
else
x=x10+copn%10;
copn=copn/10;}
while (x>0)
{ogl=ogl*10+x%10;
x=x/10;}
cout<<ogl;
return 0;
}
4.
#include <iostream>
using namespace std;
int main()
{unsigned int n,ucif;
bool ok;
cin>>n;
if (n<10)
cout<<"Numarul are o cifra";
else
ucif=n%10;
n=n/10;
ok=1;
while (n>0)
{if (ok==1)
if (ucif!=n%10)
ok=0;
n=n/10;}
if (ok==1)
cout<<"Numarul are toate cifrele identice";
else
cout<<"Numarul nu are toate cifrele identice";
return 0;}