1.
#include <iostream>
using namespace std;
int main()
{
int x,s=0,a,p=1,b,nr=0;
cin>>x;
a=x;
while(a!=0)
{
s=s+a%10;
a=a/10;
}
b=x;
while(b!=0)
{
p=p*(b%10);
b=b/10;
}
while(x!=0)
{
nr++;
x=x/10;
}
cout<<s<<" "<<p<<" "<<nr;
return 0;
}
2.
#include <iostream>
using namespace std;
int main()
{
int x,ogl=0;
cin>>x;
while(x!=0)
{
ogl=ogl*10+x%10;
x=x/10;
}
cout<<ogl;
return 0;
}
3.
#include <iostream>
using namespace std;
int main()
{
int x,ogl=0,a;
cin>>x;
a=x;
while(a!=0)
{
ogl=ogl*10+a%10;
a=a/10;
}
if(x==ogl)
cout<<"Numarul este polindrom";
else
cout<<"Numarul nu este polindrom";
return 0;
}
4.
#include <iostream>
using namespace std;
int main()
{
int x,a,u,z,p,n23,n12,b,ogl=0,n=0;
cin>>x;
u=x%10;
z=x/10%10;
a=x;
while(a!=0)
{
p=a%10;
a=a/10;
}
n23=z*10+u;
b=x;
while(b!=0)
{
ogl=ogl*10+b%10;
b=b/10;
}
n12=ogl%10*10+ogl/10%10;
while(x!=0)
{
n=n*10+x%10;
x=x/100;
}
cout<<u<<" "<<z<<" "<<p<<endl;
cout<<n23<<" "<<n12<<endl;
cout<<n;
return 0;
}
5.
#include <iostream>
using namespace std;
int main()
{
int x,cm=0,nr=0;
cin>>x;
int a=x;
while(a!=0)
{
if(cm<a%10)
cm=a%10;
a=a/10;
}
while(x!=0)
{
if(x%10==cm)
nr++;
x=x/10;
}
cout<<cm<<" "<<nr;
return 0;
}
6.
#include <iostream>
using namespace std;
int main()
{
int x,ok;
cin>>x;
int a=x%10;
while(x!=0)
{
if(x%10!=a)
{
ok=1;
break;
}
x=x/10;
}
if(ok==1)
cout<<"Nu";
else
cout<<"Da";
return 0;
}
7.
#include <iostream>
using namespace std;
int main()
{
int x,a,ok;
cin>>x;
a=x;
while(x!=0)
{
if(a%10<x/10%10)
{
ok=1;
break;
}
x=x/10;
a=a/10;
}
if(ok==1)
cout<<"Nu";
else
cout<<"Da";
return 0;
}