+ 2
Ckeck if three numbers of 4 digit numer are same
So guys, Can I check all condition in one IF CONDITION? #include <iostream> using namespace std; int main() { int n,b,a,c,d; cin>>n; a=n/1000; b=(n/100)%10; c=(n/10)%10; d=n%10; if((a==b && b==c) || (a==c && c==d) || (a==b && b==d) || (b==c && c==d)) cout << " Yes" << endl; else cout << "NO" << endl; return 0; }
4 Respostas
+ 11
I think you just did it in the code.
+ 11
Yes.
+ 3
so is it ok to write like that?
+ 3
I'm new here, So don't mind if I asked a stupid question :D