int main { int number; cout << "Enter a three-digit number: "; cin >> number;
int firstDigit = number / 100; int secondDigit = number/10number / 10number/10 % 10; int thirdDigit = number % 10; bool allDigitsSame = firstDigit==secondDigitfirstDigit == secondDigitfirstDigit==secondDigit && secondDigit==thirdDigitsecondDigit == thirdDigitsecondDigit==thirdDigit; bool anyDigitsSame = firstDigit==secondDigitfirstDigit == secondDigitfirstDigit==secondDigit || secondDigit==thirdDigitsecondDigit == thirdDigitsecondDigit==thirdDigit || firstDigit==thirdDigitfirstDigit == thirdDigitfirstDigit==thirdDigit; if allDigitsSameallDigitsSameallDigitsSame { cout << "All digits of the number are the same." << endl; } else { cout << "All digits of the number are not the same." << endl; } if anyDigitsSameanyDigitsSameanyDigitsSame { cout << "There are same digits in the number." << endl; } else { cout << "There are no same digits in the number." << endl; } return 0;
using namespace std;
int main {
int firstDigit = number / 100;int number;
cout << "Enter a three-digit number: ";
cin >> number;
int secondDigit = number/10number / 10number/10 % 10;
int thirdDigit = number % 10;
bool allDigitsSame = firstDigit==secondDigitfirstDigit == secondDigitfirstDigit==secondDigit && secondDigit==thirdDigitsecondDigit == thirdDigitsecondDigit==thirdDigit;
bool anyDigitsSame = firstDigit==secondDigitfirstDigit == secondDigitfirstDigit==secondDigit || secondDigit==thirdDigitsecondDigit == thirdDigitsecondDigit==thirdDigit || firstDigit==thirdDigitfirstDigit == thirdDigitfirstDigit==thirdDigit;
if allDigitsSameallDigitsSameallDigitsSame {
cout << "All digits of the number are the same." << endl;
} else {
cout << "All digits of the number are not the same." << endl;
}
if anyDigitsSameanyDigitsSameanyDigitsSame {
cout << "There are same digits in the number." << endl;
} else {
cout << "There are no same digits in the number." << endl;
}
return 0;
}