Răspuns :
2.include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a << endl;
cin >> b << endl;
if(b==a+1){
cout << "Numerele sunt consecutive";}
else{
cout << "Numerele nu sunt consecutive";}
return 0;}
3.#include <iostream>
using namespace std;
int main()
{
int l,a,z,d,t;
cout << "Anul: ";cin >> a;
cout << "Luna: ";cin >>l;
cout << "Ziua: ";cin >> z;
if(z+1>31)
{l+=1;
z=1;}
if(l+1>12){
a+=1;
l=1;}
cout << "Maine: Anul va fi: " << a << " Luna: " << l << " si Ziua: " << z << endl;
return 0;}
4.#include <iostream>
using namespace std;
int main(){
int a,b,c,d,min;
cout << "a: ";cin >> a;
cout << "b: ";cin >> b;
cout << "c: ";cin >> c;
cout << "d: ";cin >> d;
min=a;
if(min>b){
min=b;}
if(min>c){
min=c;}
if(min>d){
min=d;}
cout << "Cel mai mic numar dintre cele de mai sus este " << min << endl;
return 0;}
28.#include <iostream>
using namespace std;
int a,b,k(0),i;
cin >> a >> b;
for(i=a;i<=b;++i)
if(i%2==0) ++k;
cout<<k;
return 0;}
using namespace std;
int main(){
int a,b;
cin >> a << endl;
cin >> b << endl;
if(b==a+1){
cout << "Numerele sunt consecutive";}
else{
cout << "Numerele nu sunt consecutive";}
return 0;}
3.#include <iostream>
using namespace std;
int main()
{
int l,a,z,d,t;
cout << "Anul: ";cin >> a;
cout << "Luna: ";cin >>l;
cout << "Ziua: ";cin >> z;
if(z+1>31)
{l+=1;
z=1;}
if(l+1>12){
a+=1;
l=1;}
cout << "Maine: Anul va fi: " << a << " Luna: " << l << " si Ziua: " << z << endl;
return 0;}
4.#include <iostream>
using namespace std;
int main(){
int a,b,c,d,min;
cout << "a: ";cin >> a;
cout << "b: ";cin >> b;
cout << "c: ";cin >> c;
cout << "d: ";cin >> d;
min=a;
if(min>b){
min=b;}
if(min>c){
min=c;}
if(min>d){
min=d;}
cout << "Cel mai mic numar dintre cele de mai sus este " << min << endl;
return 0;}
28.#include <iostream>
using namespace std;
int a,b,k(0),i;
cin >> a >> b;
for(i=a;i<=b;++i)
if(i%2==0) ++k;
cout<<k;
return 0;}
#include
#includd
using namespace std;
main () {
float a, b, c, d, x1, x2;
cin>>a>>b>>c;
d=b*b-4*a*c;
if(d<0)
cout<<"nu există solutii reale"
else if (d=0)
cout<<"x1=x2"<<-b/(2*a)
else { x1=(-b+ sqrt d)/(2*a)
x2=(-b-sqrt d)/(2*a)
cout<<"x1="< }
return 0;
}
#includd
using namespace std;
main () {
float a, b, c, d, x1, x2;
cin>>a>>b>>c;
d=b*b-4*a*c;
if(d<0)
cout<<"nu există solutii reale"
else if (d=0)
cout<<"x1=x2"<<-b/(2*a)
else { x1=(-b+ sqrt d)/(2*a)
x2=(-b-sqrt d)/(2*a)
cout<<"x1="< }
return 0;
}