Se dau doua numere naturale, verificați dacă acestea sunt numere naturale consecutive .

Răspuns :

#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    if(a==b-1)
     cout<<"Sunt consecutive";
    else
     cout<<"Nu sunt consecutive";

    }