Răspuns:
Ex. 1)
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if(a==b+1)
{
cout<<"Nr. sunt consecutive";
}
}
Ex. 2)
#include <iostream>
using namespace std;
int main()
{
int a,b,x;
cin>>a>>b>>x;
if((a+1==x)&&(b-1==x))
{
cout<<"Nr."<<x<<" se afla intre "<<a<<" si "<<b;
}
}
Ex. 3)
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(c<0)
{
cout<<a-b;
}
if(c>0)
{
cout<<2*(a%b);
}
}