#include <stdio.h>
int main()
{
int number;
printf("Input a four-digit positive integer: ");
if(scanf("%d", &number) != 1 || number < 1000 || number > 9999)
{
printf("Bad input\n");
return 1;
}
printf("%d\n", (number / 1000) % 10);
printf("%d\n", (number / 100) % 10);
printf("%d\n", (number / 10) % 10);
printf("%d\n", number % 10);
return 0;
}
Comments
Leave a comment