The program that shows an integer n that returns the smallest integer greater than n that does not contain two identical consecutive digits
n=n+1;
int r,q,pr=-1,f=0;
int t=n;
while(f==0)
{ f=1;
t=n;
pr=-1;
while(t!=0)
{ r=t%10;
if(pr==r)
f=0;
t=t/10;
pr=r;
}
if(f!=0)
{ f=1;
return n;
}
else
f=0;
n++;
}
return 0;
Whole Program code
#include <iostream>
using namespace std;
int solution(int n)
{ n=n+1;
int r,q,pr=-1,f=0;
int t=n;
while(f==0)
{ f=1;
t=n;
pr=-1;
while(t!=0)
{ r=t%10;
if(pr==r)
f=0;
t=t/10;
pr=r;
}
if(f!=0)
{ f=1;
return n;
}
else
f=0;
n++;
}
return 0;
}
int main()
{
int n ;
cin>>n;
int ans=solution(n);
cout<<ans;
return 0;
}
Learn more about programs on:
https://brainly.com/question/26642771
#SPJ1