int main() {int num, thousands, hundreds, tens, units;
}
// Пример:// Input: 5432// Output:// Thousands: 5// Hundreds: 4// Tens: 3// Units: 2
int main() {
printf("Enter a four-digit number: ");int num, thousands, hundreds, tens, units;
scanf("%d", &num);
// Calculate the thousands, hundreds, tens and units
thousands = num / 1000;
hundreds = (num % 1000) / 100;
tens = (num % 100) / 10;
units = num % 10;
// Display the result
printf("Thousands: %d\n", thousands);
printf("Hundreds: %d\n", hundreds);
printf("Tens: %d\n", tens);
printf("Units: %d\n", units);
return 0;
}
// Пример:
// Input: 5432
// Output:
// Thousands: 5
// Hundreds: 4
// Tens: 3
// Units: 2