Răspuns :
Răspuns:
1.#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%2==0)
cout<<"numarul este par";
else
cout<<"numarul este impar";
}
2
#include<iostream>
using namespace std;
int main()
{
int a, b, x;
cin>>a>>b>>x;
if(x<b && x>a)
cout<<"x apartine intervalului a b";
else
cout<<"x nu apartine intervaluluii a b";
}
3
#include<iostream>
using namespace std;
int main()
{
int a, b, x;
cin>>a>>b>>x;
if(x<b && x>a)
cout<<"x apartine intervalului a b";
else
cout<<"x nu apartine intervaluluii a b";
}
4
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
if(a>99 && a<1000)
cout<<"numarul are trei cifre";
else
cout<<"numarul nu are trei cifre";
}
5
#include<iostream>
using namespace std;
int main()
{
int a, b, c, d;
cin>>a>>b>>c>>d;
if(c>a && c<b)
cout<<"intersectia multimilor nu este vida";
else
cout<<"intersectia multimilor este vida";
}
6
#include<iostream>
using namespace std;
int main()
{
int n, x, y, z;
cin>>n;
x=n%10;
y=n/10%10;
z=n/100;
if(x==y && y==z)
cout<<"numarul are toate cifrele egale";
else
cout<<"numarul nu are toate cifrele egale";
}
7
#include<iostream>
using namespace std;
int main()
{
int n, x, c=0;
cin>>n;
while(n!=0)
{
x=n%10;
if(x%2==1)
c++;
n=n/10;
}
cout<<c;
}
8
#include<iostream>
using namespace std;
int main()
{
int n, x, y, z, a, s=0;
x=n%10;
y=n/10%10;
z=n/100%10;
a=n/1000;
s=s+a+y;
cout<<s;
}
9
#include<iostream>
using namespace std;
int main()
{
int n, x, y, z, a, s=0, s1=0, b;
x=n%10;
y=n/10%10;
z=n/100%10;
a=n/1000%10;
b=n/10000;
s=s+x+y;
s1=s1+a+b;
if(s==s1)
cout<<"DA";
else
cout<<"NU";
}
10
#include<iostream>
using namespace std;
int main()
{
int n, ogl=0, x;
cin>>n;
x=n;
while(n!=0)
{
ogl=ogl*10+n%10;
n=n/10;
}
if(ogl==x)
cout<<"numarul este palindrom";
else
cout<<"numarul nu este palindrom";
}
Explicație: